Ensure Element#hasClassName always returns a boolean. Closes #10075.
This commit is contained in:
parent
8cd85d12a2
commit
d6b843c9cb
@ -1,5 +1,7 @@
|
||||
*SVN*
|
||||
|
||||
* Ensure Element#hasClassName always returns a boolean. Closes #10075. [ronnylovtangen, Tobie Langel]
|
||||
|
||||
* Ensure selectors of the form "[href]" (attribute token with no preceding tag name) work properly. Closes #8870. [chao, kangax, Andrew Dupont]
|
||||
|
||||
* Performance optimizations for Element#descendantOf. Costliness should no longer be dependent on the difference in depth between the parent and the child. [Andrew Dupont]
|
||||
|
@ -316,7 +316,7 @@ Element.Methods = {
|
||||
if (!(element = $(element))) return;
|
||||
var elementClassName = element.className;
|
||||
return (elementClassName.length > 0 && (elementClassName == className ||
|
||||
elementClassName.match(new RegExp("(^|\\s)" + className + "(\\s|$)"))));
|
||||
new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName)));
|
||||
},
|
||||
|
||||
addClassName: function(element, className) {
|
||||
|
@ -1403,12 +1403,12 @@
|
||||
}},
|
||||
|
||||
testHasClassName: function() {with(this) {
|
||||
assert(!$('class_names').hasClassName('does_not_exist'));
|
||||
assert($('class_names').down().hasClassName('A'));
|
||||
assert(!$('class_names').down().hasClassName('does_not_exist'));
|
||||
assert($('class_names_ul').hasClassName('A'));
|
||||
assert($('class_names_ul').hasClassName('B'));
|
||||
assert(!$('class_names_ul').hasClassName('does_not_exist'));
|
||||
assertIdentical(false, $('class_names').hasClassName('does_not_exist'));
|
||||
assertIdentical(true, $('class_names').down().hasClassName('A'));
|
||||
assertIdentical(false, $('class_names').down().hasClassName('does_not_exist'));
|
||||
assertIdentical(true, $('class_names_ul').hasClassName('A'));
|
||||
assertIdentical(true, $('class_names_ul').hasClassName('B'));
|
||||
assertIdentical(false, $('class_names_ul').hasClassName('does_not_exist'));
|
||||
}},
|
||||
|
||||
testAddClassName: function() {with(this) {
|
||||
|
Loading…
Reference in New Issue
Block a user