diff --git a/src/html5shiv-printshiv.js b/src/html5shiv-printshiv.js index bc7fb34..852e8ce 100644 --- a/src/html5shiv-printshiv.js +++ b/src/html5shiv-printshiv.js @@ -2,6 +2,8 @@ * @preserve HTML5 Shiv prev3.7.1 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed */ ;(function(window, document) { + 'use strict'; + /*jshint evil:true */ /** version */ var version = '3.7.0'; @@ -183,7 +185,7 @@ return createElement(nodeName, ownerDocument, data); }; - ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' + + ownerDocument.createDocumentFragment = new Function('h,f', 'return function(){' + 'var n=f.cloneNode(),c=n.createElement;' + 'h.shivMethods&&(' + // unroll the `createElement` calls @@ -332,7 +334,7 @@ var node, nodes = ownerDocument.getElementsByTagName('*'), index = nodes.length, - reElements = RegExp('^(?:' + getElements().join('|') + ')$', 'i'), + reElements = new RegExp('^(?:' + getElements().join('|') + ')$', 'i'), result = []; while (index--) { @@ -359,7 +361,9 @@ // copy element attributes to the wrapper while (index--) { node = nodes[index]; - node.specified && wrapper.setAttribute(node.nodeName, node.nodeValue); + if (node.specified) { + wrapper.setAttribute(node.nodeName, node.nodeValue); + } } // copy element styles to the wrapper wrapper.style.cssText = element.style.cssText; @@ -377,7 +381,7 @@ var pair, parts = cssText.split('{'), index = parts.length, - reElements = RegExp('(^|[\\s,>+~])(' + getElements().join('|') + ')(?=[[\\s,>+~#.:]|$)', 'gi'), + reElements = new RegExp('(^|[\\s,>+~])(' + getElements().join('|') + ')(?=[[\\s,>+~#.:]|$)', 'gi'), replacement = '$1' + shivNamespace + '\\:$2'; while (index--) { @@ -440,7 +444,7 @@ collection = ownerDocument.styleSheets, cssText = [], index = collection.length, - sheets = Array(index); + sheets = new Array(index); // convert styleSheets collection to an array while (index--) { diff --git a/src/html5shiv.js b/src/html5shiv.js index 205bdfe..f13be3f 100644 --- a/src/html5shiv.js +++ b/src/html5shiv.js @@ -2,6 +2,8 @@ * @preserve HTML5 Shiv prev3.7.1 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed */ ;(function(window, document) { + 'use strict'; + /*jshint evil:true */ /** version */ var version = '3.7.0'; @@ -37,14 +39,14 @@ //if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles supportsHtml5Styles = ('hidden' in a); - supportsUnknownElements = a.childNodes.length == 1 || (function() { + supportsUnknownElements = a.childNodes.length === 1 || (function() { // assign a false positive if unable to shiv (document.createElement)('a'); var frag = document.createDocumentFragment(); return ( - typeof frag.cloneNode == 'undefined' || - typeof frag.createDocumentFragment == 'undefined' || - typeof frag.createElement == 'undefined' + typeof frag.cloneNode === 'undefined' || + typeof frag.createDocumentFragment === 'undefined' || + typeof frag.createElement === 'undefined' ); }()); } catch(e) { @@ -79,7 +81,7 @@ */ function getElements() { var elements = html5.elements; - return typeof elements == 'string' ? elements.split(' ') : elements; + return typeof elements === 'string' ? elements.split(' ') : elements; } /**