Well for starters, a.href = a.href; makes no sense to me.
What's the point of that?
Then my real question is, is a.protocol suppose to have side effects, not just
a string.
Is it suppose to dip into a.href?
Object.defineProperty(A.prototype, "protocol", {
get: function() {return this.href.protocol; },
set: function(v) { this.href.protocol = v; }
});
If there are no such side effects then the code really doesn't make any sense.
You might have to dig into the behavior of the A tag to know for sure.
createWebSocketURL: function(url) {
var a;
if (url && !/^wss?:/i.test(url)) {
a = document.createElement("a");
a.href = url;
a.href = a.href;
a.protocol = a.protocol.replace("http", "ws");
return a.href;
} else {
return url;
}
},
Similar questions apply for img.src and iframe.src and form.action and other
tags that have implicit urls.
Karl Dahlke
_______________________________________________
Edbrowse-dev mailing list
[email protected]
http://lists.the-brannons.com/mailman/listinfo/edbrowse-dev