vendor: 7,017 bytes, lines 1-215
1/** 2* @preserve HTML5 Shiv v3.6.2pre | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed 3*/ 4;(function(window, document) { 5/*jshint evil:true */ 6 /** version */ 7 var version = '3.6.2pre'; 8 9 /** Preset options */ 10 var options = window.html5 || {}; 11 12 /** Used to skip problem elements */ 13 var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i; 14 15 /** Not all elements can be cloned in IE **/ 16 var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i; 17 18 /** Detect whether the browser supports default html5 styles */ 19 var supportsHtml5Styles; 20 21 /** Name of the expando, to work with multiple documents or to re-shiv one document */ 22 var expando = '_html5shiv'; 23 24 /** The id for the the documents expando */ 25 var expanID = 0; 26 27 /** Cached data for each document */ 28 var expandoData = {}; 29 30 /** Detect whether the browser supports unknown elements */ 31 var supportsUnknownElements; 32 33 (function() { 34 try { 35 var a = document.createElement('a'); 36 a.innerHTML = '<xyz></xyz>'; 37 //if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles 38 supportsHtml5Styles = ('hidden' in a); 39 40 supportsUnknownElements = a.childNodes.length == 1 || (function() { 41 // assign a false positive if unable to shiv 42 (document.createElement)('a'); 43 var frag = document.createDocumentFragment(); 44 return ( 45 typeof frag.cloneNode == 'undefined' || 46 typeof frag.createDocumentFragment == 'undefined' || 47 typeof frag.createElement == 'undefined' 48 ); 49 }()); 50 } catch(e) { 51 supportsHtml5Styles = true; 52 supportsUnknownElements = true; 53 } 54 55 }()); 56 57 /*--------------------------------------------------------------------------*/ 58 59 /** 60 * Creates a style sheet with the given CSS text and adds it to the document. 61 * @private 62 * @param {Document} ownerDocument The document. 63 * @param {String} cssText The CSS text. 64 * @returns {StyleSheet} The style element. 65 */ 66 function addStyleSheet(ownerDocument, cssText) { 67 var p = ownerDocument.createElement('p'), 68 parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement; 69 70 p.innerHTML = 'x<style>' + cssText + '</style>'; 71 return parent.insertBefore(p.lastChild, parent.firstChild); 72 } 73 74 /** 75 * Returns the value of `html5.elements` as an array. 76 * @private 77 * @returns {Array} An array of shived element node names. 78 */ 79 function getElements() { 80 var elements = html5.elements; 81 return typeof elements == 'string' ? elements.split(' ') : elements; 82 } 83 84 /** 85 * Returns the data associated to the given document 86 * @private 87 * @param {Document} ownerDocument The document. 88 * @returns {Object} An object of data. 89 */ 90 function getExpandoData(ownerDocument) { 91 var data = expandoData[ownerDocument[expando]]; 92 if (!data) { 93 data = {}; 94 expanID++; 95 ownerDocument[expando] = expanID; 96 expandoData[expanID] = data; 97 } 98 return data; 99 } 100 101 /** 102 * returns a shived element for the given nodeName and document 103 * @memberOf html5 104 * @param {String} nodeName name of the element 105 * @param {Document} ownerDocument The context document. 106 * @returns {Object} The shived element. 107 */ 108 function createElement(nodeName, ownerDocument, data){ 109 if (!ownerDocument) { 110 ownerDocument = document; 111 } 112 if(supportsUnknownElements){ 113 return ownerDocument.createElement(nodeName); 114 } 115 if (!data) { 116 data = getExpandoData(ownerDocument); 117 } 118 var node; 119 120 if (data.cache[nodeName]) { 121 node = data.cache[nodeName].cloneNode(); 122 } else if (saveClones.test(nodeName)) { 123 node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode(); 124 } else { 125 node = data.createElem(nodeName); 126 } 127 128 // Avoid adding some elements to fragments in IE < 9 because 129 // * Attributes like `name` or `type` cannot be set/changed once an element 130 // is inserted into a document/fragment 131 // * Link elements with `src` attributes that are inaccessible, as with 132 // a 403 response, will cause the tab/window to crash 133 // * Script elements appended to fragments will execute when their `src` 134 // or `text` property is set 135 return node.canHaveChildren && !reSkip.test(nodeName) ? data.frag.appendChild(node) : node; 136 } 137 138 /** 139 * returns a shived DocumentFragment for the given document 140 * @memberOf html5 141 * @param {Document} ownerDocument The context document. 142 * @returns {Object} The shived DocumentFragment. 143 */ 144 function createDocumentFragment(ownerDocument, data){ 145 if (!ownerDocument) { 146 ownerDocument = document; 147 } 148 if(supportsUnknownElements){ 149 return ownerDocument.createDocumentFragment(); 150 } 151 data = data || getExpandoData(ownerDocument); 152 var clone = data.frag.cloneNode(), 153 i = 0, 154 elems = getElements(), 155 l = elems.length; 156 for(;i<l;i++){ 157 clone.createElement(elems[i]); 158 } 159 return clone; 160 } 161 162 /** 163 * Shivs the `createElement` and `createDocumentFragment` methods of the document. 164 * @private 165 * @param {Document|DocumentFragment} ownerDocument The document. 166 * @param {Object} data of the document. 167 */ 168 function shivMethods(ownerDocument, data) { 169 if (!data.cache) { 170 data.cache = {}; 171 data.createElem = ownerDocument.createElement; 172 data.createFrag = ownerDocument.createDocumentFragment; 173 data.frag = data.createFrag(); 174 } 175 176 177 ownerDocument.createElement = function(nodeName) { 178 //abort shiv 179 if (!html5.shivMethods) { 180 return data.createElem(nodeName); 181 } 182 return createElement(nodeName, ownerDocument, data); 183 }; 184 185 ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' + 186 'var n=f.cloneNode(),c=n.createElement;' + 187 'h.shivMethods&&(' + 188 // unroll the `createElement` calls 189 getElements().join().replace(/\w+/g, function(nodeName) { 190 data.createElem(nodeName); 191 data.frag.createElement(nodeName); 192 return 'c("' + nodeName + '")'; 193 }) + 194 ');return n}' 195 )(html5, data.frag); 196 } 197 198 /*--------------------------------------------------------------------------*/ 199 200 /** 201 * Shivs the given document. 202 * @memberOf html5 203 * @param {Document} ownerDocument The document to shiv. 204 * @returns {Document} The shived document. 205 */ 206 function shivDocument(ownerDocument) { 207 if (!ownerDocument) { 208 ownerDocument = document; 209 } 210 var data = getExpandoData(ownerDocument); 211 212 if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) { 213 data.hasCSS = !!addStyleSheet(ownerDocument, 214 // corrects block display not defined in IE6/7/8/9 215 'article,aside,figcaption,figure,footer,header,hgroup,nav,section{dis
215play:block}' + 216 // adds styling not present in IE6/7/8/9 217 'mark{background:#FF0;color:#000}' 218 ); 219 } 220 if (!supportsUnknownElements) { 221 shivMethods(ownerDocument, data); 222 } 223 return ownerDocument; 224 } 225 226 /*--------------------------------------------------------------------------*/ 227 228 /** 229 * The `html5` object is exposed so that more elements can be shived and 230 * existing shiving can be detected on iframes. 231 * @type Object 232 * @example 233 * 234 * // options can be changed before the script is included 235 * html5 = { 'elements': 'mark section', 'shivCSS': false, 'shivMethods': false }; 236 */ 237 var html5 = { 238 239 /** 240 * An array or space separated string of node names of the elements to shiv. 241 * @memberOf html5 242 * @type Array|String 243 */ 244 'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video', 245 246 /** 247 * current version of html5shiv 248 */ 249 'version': version, 250 251 /** 252 * A flag to indicate that the HTML5 style sheet should be inserted. 253 * @memberOf html5 254 * @type Boolean 255 */ 256 'shivCSS': (options.shivCSS !== false), 257 258 /** 259 * Is equal to true if a browser supports creating unknown/HTML5 elements 260 * @memberOf html5 261 * @type boolean 262 */ 263 'supportsUnknownElements': supportsUnknownElements, 264 265 /** 266 * A flag to indicate that the document's `createElement` and `createDocumentFragment` 267 * methods should be overwritten. 268 * @memberOf html5 269 * @type Boolean 270 */ 271 'shivMethods': (options.shivMethods !== false), 272 273 /** 274 * A string to describe the type of `html5` object ("default" or "default print"). 275 * @memberOf html5
276 * @type String 277 */ 278 'type': 'default', 279 280 // shivs the document according to the specified `html5` object options 281 'shivDocument': shivDocument, 282 283 //creates a shived element 284 createElement: createElement, 285 286 //creates a shived documentFragment 287 createDocumentFragment: createDocumentFragment 288 }; 289 290 /*--------------------------------------------------------------------------*/ 291 292 // expose html5 293 window.html5 = html5; 294 295 // shiv the document 296 shivDocument(document); 297 298}(this, document));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.