* Fixed IE ID selectors selecting by the name attribute and added tests
* Added href attribute test to test suite * Updated Changelog
This commit is contained in:
parent
4259b02c99
commit
44599e174b
|
@ -7,7 +7,9 @@ New and Noteworthy
|
||||||
1.1.2
|
1.1.2
|
||||||
----
|
----
|
||||||
|
|
||||||
|
* Fixed IE ID selectors selecting by the name attribute.
|
||||||
* Change: Events are now internally stored in elem.$events rather than elem.events (due to a nasty bug relating to DOM 0 expandos).
|
* Change: Events are now internally stored in elem.$events rather than elem.events (due to a nasty bug relating to DOM 0 expandos).
|
||||||
|
* .attr('href') is now consistent in all browsers.
|
||||||
* @href is now consistent in all browsers.
|
* @href is now consistent in all browsers.
|
||||||
* Fixed the slideDown flickering bug.
|
* Fixed the slideDown flickering bug.
|
||||||
* Having a \r endline in $("...") caused a never-ending loop.
|
* Having a \r endline in $("...") caused a never-ending loop.
|
||||||
|
|
9
src/jquery/coreTest.js
vendored
9
src/jquery/coreTest.js
vendored
|
@ -74,7 +74,7 @@ test("index(Object)", function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("attr(String)", function() {
|
test("attr(String)", function() {
|
||||||
expect(14);
|
expect(15);
|
||||||
ok( $('#text1').attr('value') == "Test", 'Check for value attribute' );
|
ok( $('#text1').attr('value') == "Test", 'Check for value attribute' );
|
||||||
ok( $('#text1').attr('type') == "text", 'Check for type attribute' );
|
ok( $('#text1').attr('type') == "text", 'Check for type attribute' );
|
||||||
ok( $('#radio1').attr('type') == "radio", 'Check for type attribute' );
|
ok( $('#radio1').attr('type') == "radio", 'Check for type attribute' );
|
||||||
|
@ -87,7 +87,10 @@ test("attr(String)", function() {
|
||||||
ok( $('#name').attr('name') == "name", 'Check for name attribute' );
|
ok( $('#name').attr('name') == "name", 'Check for name attribute' );
|
||||||
ok( $('#text1').attr('name') == "action", 'Check for name attribute' );
|
ok( $('#text1').attr('name') == "action", 'Check for name attribute' );
|
||||||
ok( $('#form').attr('action').indexOf("formaction") >= 0, 'Check for action attribute' );
|
ok( $('#form').attr('action').indexOf("formaction") >= 0, 'Check for action attribute' );
|
||||||
//equals( "#2", $('#anchor2').attr('href'), 'Check for non-absolute href (an anchor)' ); This fails in IE because the _config.fixture is reloaded using innerHTML
|
|
||||||
|
$('<a id="tAnchor5"></a>').attr('href', '#5').appendTo('#main'); // using innerHTML in IE causes href attribute to be serialized to the full path
|
||||||
|
ok( $('#tAnchor5').attr('href') == "#5", 'Check for non-absolute href (an anchor)' );
|
||||||
|
|
||||||
stop();
|
stop();
|
||||||
$.get("data/dashboard.xml", function(xml) {
|
$.get("data/dashboard.xml", function(xml) {
|
||||||
ok( $("locations", xml).attr("class") == "foo", "Check class attribute in XML document" );
|
ok( $("locations", xml).attr("class") == "foo", "Check class attribute in XML document" );
|
||||||
|
@ -242,7 +245,7 @@ test("append(String|Element|Array<Element>|jQuery)", function() {
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
$("#sap").append(document.getElementById('form'));
|
$("#sap").append(document.getElementById('form'));
|
||||||
ok( $("#sap>form").size() == 1, "Check for appending a form" );
|
ok( $("#sap>form").size() == 1, "Check for appending a form" ); // Bug #910
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -223,11 +223,15 @@ jQuery.extend({
|
||||||
if ( m[1] == "#" && ret[ret.length-1].getElementById ) {
|
if ( m[1] == "#" && ret[ret.length-1].getElementById ) {
|
||||||
// Optimization for HTML document case
|
// Optimization for HTML document case
|
||||||
var oid = ret[ret.length-1].getElementById(m[2]);
|
var oid = ret[ret.length-1].getElementById(m[2]);
|
||||||
|
|
||||||
|
// Do a quick check for the existence of the actual ID attribute
|
||||||
|
// to avoid selecting by the name attribute in IE
|
||||||
|
if ( jQuery.browser.msie && oid && oid.id != m[2] )
|
||||||
|
oid = jQuery('[@id="'+m[2]+'"]', ret[ret.length-1])[0];
|
||||||
|
|
||||||
// Do a quick check for node name (where applicable) so
|
// Do a quick check for node name (where applicable) so
|
||||||
// that div#foo searches will be really fast
|
// that div#foo searches will be really fast
|
||||||
ret = r = oid &&
|
ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];
|
||||||
(!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Pre-compile a regular expression to handle class searches
|
// Pre-compile a regular expression to handle class searches
|
||||||
|
|
|
@ -11,7 +11,7 @@ test("expressions - element", function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("expressions - id", function() {
|
test("expressions - id", function() {
|
||||||
expect(11);
|
expect(13);
|
||||||
t( "ID Selector", "#body", ["body"] );
|
t( "ID Selector", "#body", ["body"] );
|
||||||
t( "ID Selector w/ Element", "body#body", ["body"] );
|
t( "ID Selector w/ Element", "body#body", ["body"] );
|
||||||
t( "ID Selector w/ Element", "ul#first", [] );
|
t( "ID Selector w/ Element", "ul#first", [] );
|
||||||
|
@ -25,7 +25,11 @@ test("expressions - id", function() {
|
||||||
t( "All Children of ID", "#foo/*", ["sndp", "en", "sap"] );
|
t( "All Children of ID", "#foo/*", ["sndp", "en", "sap"] );
|
||||||
t( "All Children of ID with no children", "#firstUL/*", [] );
|
t( "All Children of ID with no children", "#firstUL/*", [] );
|
||||||
|
|
||||||
t( "ID selector with non-existant ancestor", "#asdfasdf #foobar", [] );
|
$('<a name="tName1">tName1 A</a><a name="tName2">tName2 A</a><div id="tName1">tName1 Div</div>').appendTo('#main');
|
||||||
|
ok( $("#tName1")[0].id == 'tName1', "ID selector with same value for a name attribute" );
|
||||||
|
ok( $("#tName2").length == 0, "ID selector non-existing but name attribute on an A tag" );
|
||||||
|
|
||||||
|
t( "ID selector with non-existant ancestor", "#asdfasdf #foobar", [] ); // bug #986
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue