Skip to content

Commit 75da7cf

Browse files
committed
Comment consistency
1 parent 7692ab3 commit 75da7cf

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Diff for: loadCSS.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,23 @@ function loadCSS( href, before, media ){
1515
Arguments explained:
1616
- `href` is the optional URL or array of URLs for your CSS file(s).
1717
- `before` optionally defines the element we'll use as a reference for injecting our <link>
18-
By default, `before` uses the first <script> element in the page.
18+
By default, `before` uses the first `<script>` element in the page.
1919
However, since the order in which stylesheets are referenced matters, you might need a more specific location in your document.
2020
If so, pass a different reference element to the `before` argument and it'll insert before that instead
21-
- `media` is the value for the <link>'s media attribute. Default is "all" or if using the <noscript> option, whatever the original's attribute is.
21+
- `media` is the value for the `<link>`'s media attribute. Default is "all" or if using the `<noscript>` option, whatever the original's attribute is.
2222
2323
Note: `insertBefore` is used instead of `appendChild`, for safety re: http://www.paulirish.com/2011/surefire-dom-element-insertion/
2424
*/
2525

26-
// Create a <link> element
26+
// Create a `<link>` element
2727
function makeLink(href) {
2828
var ss = window.document.createElement( "link" );
2929
ss.rel = "stylesheet";
3030
ss.href = href;
3131
return ss;
3232
}
3333

34-
// Inject <link> into DOM
34+
// Inject `<link>` into DOM
3535
function injectLink(ss,ref) {
3636
// Save a reference to the original media attribute, use the `media` argument, or default to "all"
3737
var ssMedia = ss.media || media || "all";
@@ -57,26 +57,26 @@ function loadCSS( href, before, media ){
5757
injectLink(makeLink(href),ref);
5858
}
5959
} else {
60-
// Otherwise, find all `noscript` elements with the class `async-css` and pull any `link` elements from there
60+
// Otherwise, find all `noscript` elements with the class `async-css` and pull any `<link>` elements from there
6161
var noscripts = window.document.getElementsByTagName("noscript");
6262

6363
if ( noscripts.length ) {
64-
// Create a dummy element to drop all of the `noscript`s contents into to check for `link` elements
64+
// Create a dummy element to drop all of the `<noscript>`s contents into to check for `<link>` elements
6565
var el = window.document.createElement('div');
6666

6767
for (i = 0; i < noscripts.length; i++ ) {
68-
// Make sure this `noscript` has the `loadCSS` class and has not already been loaded
68+
// Make sure this `<noscript>` has the `loadCSS` class and has not already been loaded
6969
if ( ( " "+noscripts[i].className+" ").indexOf(' loadCSS ') > -1 && ( " "+noscripts[i].className+" ").indexOf(' loaded ') === -1 ) {
7070
el.innerHTML += " " + noscripts[i].innerText;
7171
noscripts[i].className += " loaded ";
7272
}
7373
}
7474

75-
// Extract the link elements from our dummy element, `el`
75+
// Extract the `<link>` elements from our dummy element, `el`
7676
var links = el.getElementsByTagName("link");
7777

7878
for (i = 0; i < links.length; i++ ) {
79-
// Clone the link element to prevent issues with skipped elements
79+
// Clone the `<link>` element to prevent issues with skipped elements
8080
var link = links[i].cloneNode(true);
8181
injectLink(link,ref);
8282
}

0 commit comments

Comments
 (0)