
Originally Posted by
Twey
I don't much bother supporting DOM-2 incompliant browsers any more.
Shame, considering the level of "support" here is trivial to implement (though I didn't have time when I posted last).

Originally Posted by
Trinithis
I noticed that the the callback only occurs if async, so I "combined" the two paramaters into an optional one. By default, it is asyncronized because of XHTML.
What's special about XHTML? If you're referring to the DOM differences between HTML (and pseudo-XHTML) and XHTML, might I remind you that XHTML uses namespaces, therefore the namespace-aware methods would need to be used.
For many non-trivial scripts, one written for a HTML (or pseudo-XHTML) DOM cannot be used for a XHTML DOM.
I can't fathom putting a .js file on the other side of a frag delimitor.
The other side? No, I was referring to a hash character that was part of the query string. If included literally, it would be interpreted as fragment delimiter.
It doesn't make sense, but perhaps some other non-encoded characters would make sense, but I would have to see one first to believe.
The example of the fragment delimiter was the first to come to mind, and I was in a rush. Perhaps a more feasible, though still uncommon, example would be an ampersand (&) or equals (=) when the script is dynamically generated.
My point was that these details are for the user to resolve, not the include script.

Originally Posted by
Twey
In light of what Mike said, let's encode it, eh?
That wasn't the conclusion to be drawn.
Hmm, it's worked in all the browsers in which I've ever tried it...
The innerHTML property probably also worked in the majority of browsers you've tried, yet you were quite set against it, citing a lack of formal specification. The same applies to the load event in this context.
I think it might be cause for a warning message with the script, but probably not exclusion of the whole feature.
I didn't suggesting excluding the feature, just implementing it differently: at the end of the included script - let's call it utilities.js - there could be the following:
Code:
if (typeof utilitiesCallback == 'function') utilitiesCallback();
This is entirely reliable.
Code:
function include(uri, dynamic) {
if (dynamic) {
var head, script;
if (document.createElement && document.getElementsByTagName
&& (head = document.getElementsByTagName('head')[0]) && head.appendChild
&& (script = document.createElement('script'))) {
script.type = 'text/javascript';
script.src = uri;
head.appendChild(script);
} else return false;
} else document.write('<script type="text/javascript" src="' + uri + '"><\/script>');
return true;
}
Bookmarks