I am only asking this, because I am really confused about this and even trimming doesn't help getting this comparison pass.
Code:
HTML
<div id="someDiv"></div>
CSS
#someDiv {
content: "someValue";
}
JQuery
$(document).ready(function() {
var value = $("#someDiv").css("content");
value = $.trim(value);
console.log(value);
if (value == "someValue") {
console.log("good");
}
else {
console.log("bad");
}
});
Why does the string comparison fail here?
EDIT: The strange thing that got me confused was that this comparison was OK in Chrome/Chromium but not in Firefox.
What about replacing quotes and double quotes in the beginning and end of content? Maybe adding something like this after trimming?
value = value.replace(/^(\"|\')|(\"|\')$/g, "");
FIDDLE (Works on both Chrome and Firefox)