]> source.dussan.org Git - jquery.git/commitdiff
Manipulation: Change support test to be WWA-friendly
authorJonathan Sampson <jjdsampson@gmail.com>
Tue, 11 Mar 2014 07:44:34 +0000 (03:44 -0400)
committerDave Methvin <dave.methvin@gmail.com>
Thu, 20 Mar 2014 20:54:37 +0000 (16:54 -0400)
Setting the innerHTML property in an unsafe manner raises issues in
Windows Web Applications. Strings being passed into innerHTML cannot
include the name attribute.

Closes gh-1537

src/manipulation/support.js

index e2ba066ecdccbbf7837d5ba727b9b0299cb98395..fb1e855679965c1f464f4fbe4b3d3519b5cd4faf 100644 (file)
@@ -4,10 +4,17 @@ define([
 
 (function() {
        var fragment = document.createDocumentFragment(),
-               div = fragment.appendChild( document.createElement( "div" ) );
+               div = fragment.appendChild( document.createElement( "div" ) ),
+               input = document.createElement( "input" );
 
        // #11217 - WebKit loses check when the name is after the checked attribute
-       div.innerHTML = "<input type='radio' checked='checked' name='t'/>";
+       // Support: Windows Web Apps (WWA)
+       // `name` and `type` need .setAttribute for WWA
+       input.setAttribute( "type", "radio" );
+       input.setAttribute( "checked", "checked" );
+       input.setAttribute( "name", "t" );
+
+       div.appendChild( input );
 
        // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
        // old WebKit doesn't clone checked state correctly in fragments