You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The name "class" must be quoted in the object since it is a JavaScript reserved word, and "className" cannot be used since it refers to the DOM property, not the attribute.
I was wondering if you have identified scenarios/versions where this is RELEVANT.
I did some tests using this minimal code, in:
Google Chrome: OK
Safari: OK
Firefox: OK
MS Edge: OK
IE 11: OK
IE 10 (Emulation): OK
IE 9 (Emulation): OK
IE 8 (Emulation): FAILS
IE 7 (Emulation): FAILS
So, it seems, this code ONLY fails on IE 8 and older versions of that browser, is that correct?
Thanks in advance.
Best regards.
<!doctype html><htmllang="en"><body><h1>jQuery test</h1><p>"Appended text" will be appended. Check your console too!</p><scriptsrc="./js/jquery-3.4.1.min.js"></script><script>(function($){var$p=$('<p>',{class: 'b-info',// I am not using quotes for "class"text: 'Appended text'});$('body').append($p);})(jQuery);</script></body></html>
The text was updated successfully, but these errors were encountered:
alex-arriaga
changed the title
In what scenarios the docs about 'The name "class" must be quoted in the object...' is relevant?
In what scenarios the docs about 'The name "class" must be quoted in the object...' are relevant?
Nov 21, 2019
jQuery version: 3.4.1
Hi jQuery docs team!
While I was reformatting some code with an automated tool, I noticed that tool removes the quotes in this kind of code:
So, I went back to jQuery docs in https://api.jquery.com/jquery/ where it is said:
I was wondering if you have identified scenarios/versions where this is RELEVANT.
I did some tests using this minimal code, in:
So, it seems, this code ONLY fails on IE 8 and older versions of that browser, is that correct?
Thanks in advance.
Best regards.
The text was updated successfully, but these errors were encountered: