-
Notifications
You must be signed in to change notification settings - Fork 264
Document that addClass and removeClass change the property #813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@agcolom @kswedberg Fixed! Thank you for the feedback. |
@@ -19,6 +19,7 @@ | |||
<desc>Adds the specified class(es) to each element in the set of matched elements.</desc> | |||
<longdesc> | |||
<p>It's important to note that this method does not replace a class. It simply adds the class, appending it to any which may already be assigned to the elements.</p> | |||
<p><code>.addClass()</code> manipulates the property of the selected elements, not the attribute. Once the property is changed, it's the browser that updates the <code>class</code> attribute accordingly. An implication of this behavior is that this method only works for documents with HTML DOM semantics (e.g., not pure XML documents).</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it makes sense to also mention which property we're actually talking about, instead of just "the property"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arthurvr, @AurelioDeRosa: 👍 to specifying the property. Maybe something like this?…
The .addClass()
method manipulates the className
property of the selected elements, not the class
attribute. Once the property is changed, it's the browser that updates the attribute accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note also that behavior will change in jQuery 3.0, where we will set the class
attribute instead of the className
property for better SVG support: jquery/jquery#2199
PR updated. @gibson042 I'll open a separate issue for that and create a different PR if you agree. This way we can merge it into the relevant branch. |
👍 |
Anyone keen for a final review of this? |
LGTM, and we will revisit it when 3.0 lands. |
Fixes gh-312