mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Tests: Workaround IE issues in qunit-assert-domequal
In IE, `option` elements may have different initial `option` colors. They may initially all be transparent, but later the selected option gets a blue background with white text; we now ignore it. The logic of `qunit-assert-domequal` was also fixed to use the same method of fetching styles in all browsers; IE used to get a legacy one meant for IE <9 due to a mistake in the performed check.
This commit is contained in:
parent
613b522e9a
commit
ba249efb6b
@ -38,6 +38,7 @@ var domEqual = QUnit.assert.domEqual = function( selector, modifier, message ) {
|
|||||||
|
|
||||||
domEqual.properties = [
|
domEqual.properties = [
|
||||||
"disabled",
|
"disabled",
|
||||||
|
"nodeName",
|
||||||
"readOnly"
|
"readOnly"
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -59,7 +60,6 @@ domEqual.attributes = [
|
|||||||
"class",
|
"class",
|
||||||
"href",
|
"href",
|
||||||
"id",
|
"id",
|
||||||
"nodeName",
|
|
||||||
"role",
|
"role",
|
||||||
"tabIndex",
|
"tabIndex",
|
||||||
"title"
|
"title"
|
||||||
@ -76,23 +76,26 @@ function getElementStyles( elem ) {
|
|||||||
var style = elem.ownerDocument.defaultView ?
|
var style = elem.ownerDocument.defaultView ?
|
||||||
elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
|
elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
|
||||||
elem.currentStyle;
|
elem.currentStyle;
|
||||||
var key, len;
|
var key, camelKey;
|
||||||
|
var len = style.length;
|
||||||
|
|
||||||
if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
|
while ( len-- ) {
|
||||||
len = style.length;
|
key = style[ len ];
|
||||||
while ( len-- ) {
|
camelKey = camelCase( key );
|
||||||
key = style[ len ];
|
|
||||||
if ( typeof style[ key ] === "string" ) {
|
// Support: IE <=11+
|
||||||
styles[ camelCase( key ) ] = style[ key ];
|
// In IE, `option` elements may have different initial `option` colors.
|
||||||
}
|
// They may initially all be transparent, but later the selected
|
||||||
|
// option gets a blue background with white text; ignore it.
|
||||||
|
if ( document.documentMode && elem.nodeName.toLowerCase() === "option" && (
|
||||||
|
camelKey === "color" ||
|
||||||
|
camelKey.indexOf( "Color" ) === camelKey.length - "Color".length
|
||||||
|
) ) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Support: Opera, IE <9
|
if ( typeof style[ key ] === "string" ) {
|
||||||
} else {
|
styles[ camelKey ] = style[ key ];
|
||||||
for ( key in style ) {
|
|
||||||
if ( typeof style[ key ] === "string" ) {
|
|
||||||
styles[ key ] = style[ key ];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user