The spec seems to indicate that inline stylesheets (the content contained within a style
attribute) are included in the document.styleSheets
list. The relevant part is probably this:
For inline style sheets, the value of this attribute is null.
So, if you have any style attributes on any elements, you're going to get a null-reference error when trying to read a value off .href
.
A simple fix is to add a check for null
:
function loadCssCache(s,callback){
if(s.href == null || s.href.indexOf(location.host) == -1 || s.href.indexOf(location.host) > 50){
return false
}
}