Skip to content

Commit

Permalink
Added DOM.strict for checking whether the document is in strict mode.…
Browse files Browse the repository at this point in the history
… The new renderer is going to need this.
  • Loading branch information
sorccu committed Feb 5, 2011
1 parent 1825c97 commit fc4e121
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion js/cufon.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,24 @@ var Cufon = (function() {

root: function() {
return document.documentElement || document.body;
}
},

strict: (function() {
var doctype;
// no doctype (doesn't always catch it though.. IE I'm looking at you)
if (document.compatMode == 'BackCompat') return false;
// WebKit, Gecko, Opera, IE9+
doctype = document.doctype;
if (doctype) {
return !/frameset|transitional/i.test(doctype.publicId);
}
// IE<9, firstChild is the doctype even if there's an XML declaration
doctype = document.firstChild;
if (doctype.nodeType != 8 || /^DOCTYPE.+(transitional|frameset)/i.test(doctype.data)) {
return false;
}
return true;
})()

};

Expand Down

0 comments on commit fc4e121

Please sign in to comment.