|
50 | 50 | /*--------------------------------------------------------------------------*/
|
51 | 51 |
|
52 | 52 | /**
|
53 |
| - * Creates a style sheet with the given CSS text and adds it to the document. |
| 53 | + * Creates a style sheet with a shiv CSS text and adds it to the document. |
54 | 54 | * @private
|
55 | 55 | * @param {Document} ownerDocument The document.
|
56 | 56 | * @param {String} cssText The CSS text.
|
57 | 57 | * @returns {StyleSheet} The style element.
|
58 | 58 | */
|
59 |
| - function addStyleSheet(ownerDocument, cssText) { |
| 59 | + function addStyleSheet(ownerDocument) { |
60 | 60 | var p = ownerDocument.createElement('p'),
|
61 | 61 | parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;
|
62 | 62 |
|
63 |
| - p.innerHTML = 'x<style>' + cssText + '</style>'; |
| 63 | + p.innerHTML = 'x<style>' + |
| 64 | + // corrects block display not defined in IE6/7/8/9 |
| 65 | + 'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' + |
| 66 | + // adds styling not present in IE6/7/8/9 |
| 67 | + 'mark{background:#FF0;color:#000}' + |
| 68 | + // hides non-rendered elements |
| 69 | + 'template{display:none}' + |
| 70 | + '</style>'; |
64 | 71 | return parent.insertBefore(p.lastChild, parent.firstChild);
|
65 | 72 | }
|
66 | 73 |
|
|
221 | 228 | var data = getExpandoData(ownerDocument);
|
222 | 229 |
|
223 | 230 | if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) {
|
224 |
| - data.hasCSS = !!addStyleSheet(ownerDocument, |
225 |
| - // corrects block display not defined in IE6/7/8/9 |
226 |
| - 'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' + |
227 |
| - // adds styling not present in IE6/7/8/9 |
228 |
| - 'mark{background:#FF0;color:#000}' + |
229 |
| - // hides non-rendered elements |
230 |
| - 'template{display:none}' |
231 |
| - ); |
| 231 | + data.hasCSS = !!addStyleSheet(ownerDocument); |
232 | 232 | }
|
233 | 233 | if (!supportsUnknownElements) {
|
234 | 234 | shivMethods(ownerDocument, data);
|
|
0 commit comments