diff --git a/entries/hasClass.xml b/entries/hasClass.xml index 37b52f79..ddf5d893 100644 --- a/entries/hasClass.xml +++ b/entries/hasClass.xml @@ -25,6 +25,7 @@ $( "#mydiv" ).hasClass( "bar" )
$( "#mydiv" ).hasClass( "quux" )
+ As of jQuery 1.12/2.2, this method supports XML documents, including SVG.
Before jQuery version 1.12/2.2, the .toggleClass()
method manipulated the className
property of the selected elements, not the class
attribute. Once the property was changed, it was the browser that updated the attribute accordingly. An implication of this behavior was that this method only worked for documents with HTML DOM semantics (e.g., not pure XML documents).
As of jQuery 1.12/2.2, this behavior is changed to improve the support for XML documents, including SVG. Starting from this version, the class
attribute is used instead. So, .toggleClass()
can be used on XML or SVG documents.
This method takes one or more class names as its parameter. In the first version, if an element in the matched set of elements already has the class, then it is removed; if an element does not have the class, then it is added. For example, we can apply .toggleClass()
to a simple <div>
:
<div class="tumble">Some text.</div>