Commit 03fdc70a authored by Timmy Willison's avatar Timmy Willison

Correct the checkClone support test for Safari 5.1 and mobile webkits

Conflicts:
	src/manipulation/support.js
parent 7a6c635c
...@@ -3,14 +3,13 @@ define([ ...@@ -3,14 +3,13 @@ define([
], function( support ) { ], function( support ) {
(function () { (function () {
var input, fragment, var fragment = document.createDocumentFragment(),
div = document.createElement("div"); div = document.createElement("div"),
input = document.createElement("input");
// Setup // Setup
div.setAttribute( "className", "t" ); div.setAttribute( "className", "t" );
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; div.innerHTML = " <link/><table></table><a href='/a'>a</a>";
input = div.getElementsByTagName("input")[ 0 ];
input.type = "checkbox";
// IE strips leading whitespace when .innerHTML is used // IE strips leading whitespace when .innerHTML is used
support.leadingWhitespace = div.firstChild.nodeType === 3; support.leadingWhitespace = div.firstChild.nodeType === 3;
...@@ -32,20 +31,18 @@ define([ ...@@ -32,20 +31,18 @@ define([
input.checked = true; input.checked = true;
support.noCloneChecked = input.cloneNode( true ).checked; support.noCloneChecked = input.cloneNode( true ).checked;
// #11217 - WebKit loses check when the name is after the checked attribute
input.checked = false;
input.setAttribute( "checked", "t" );
input.setAttribute( "name", "t" );
fragment = document.createDocumentFragment();
fragment.appendChild( input );
// Check if a disconnected checkbox will retain its checked // Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7) // value of true after appended to the DOM (IE6/7)
fragment.appendChild( input );
support.appendChecked = input.checked; support.appendChecked = input.checked;
// WebKit doesn't clone checked state correctly in fragments // #11217 - WebKit loses check when the name is after the checked attribute
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; fragment.appendChild( div );
div.innerHTML = "<input type='radio' checked name='t'/>";
// Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
// old WebKit doesn't clone checked state correctly in fragments
support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
// Support: IE<9 // Support: IE<9
// Opera does not clone events (and typeof div.attachEvent === undefined). // Opera does not clone events (and typeof div.attachEvent === undefined).
...@@ -71,7 +68,7 @@ define([ ...@@ -71,7 +68,7 @@ define([
} }
// Null elements to avoid leaks in IE. // Null elements to avoid leaks in IE.
input = fragment = div = null; fragment = div = input = null;
})(); })();
return support; return support;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment