Re: Is jQuery worth a second look?
- From: dhtml <dhtmlkitchen@xxxxxxxxx>
- Date: Tue, 30 Sep 2008 09:44:26 -0700
Oltmans wrote:
On Sep 30, 6:38 pm, "Thomas 'PointedEars' Lahn" <PointedE...@xxxxxx>
wrote:
kangax wrote:dhtml wrote:Irrelevant, except that it shows their cluelessness.isFunction - still uses function decompilation. Kangax posted onGarrett,
es-discuss that that was changed but I still see the isFunction in the
latest 1.2.6.
their trunk is using `instanceof` [1].
Why using "instanceof" considered to be not so good? Can you please
explain it to me with a few examples? That will be highly appreciated.
Instanceof won't work like you want it to across frames. This is because self.Function != frames[0].Function.
frames[0].fun instanceof Function will return false across frames.
Two documents example:
document1.html
myframe.html:
document1.html:
<body>
<iframe src="myframe.html"></iframe>
<script>
onload = function() {
var f = frames[0].fun;
document.write(['<pre>',f instanceof Function, f].join('\n'));
document.close();
};
</script>
</body>
myframe.html:
<script>
function fun() {}
</script>
Result:
false
function fun() {
}
So we can see that instanceof won't work across frames like you'd want it to, and the isFunction uses instance of.
Garrett
.
- Follow-Ups:
- Re: Is jQuery worth a second look?
- From: Oltmans
- Re: Is jQuery worth a second look?
- References:
- Is jQuery worth a second look?
- From: RobG
- Re: Is jQuery worth a second look?
- From: Joost Diepenmaat
- Re: Is jQuery worth a second look?
- From: RobG
- Re: Is jQuery worth a second look?
- From: dhtml
- Re: Is jQuery worth a second look?
- From: Conrad Lender
- Re: Is jQuery worth a second look?
- From: dhtml
- Re: Is jQuery worth a second look?
- From: kangax
- Re: Is jQuery worth a second look?
- From: Thomas 'PointedEars' Lahn
- Re: Is jQuery worth a second look?
- From: Oltmans
- Is jQuery worth a second look?
- Prev by Date: Re: Is jQuery worth a second look?
- Next by Date: Re: Is jQuery worth a second look?
- Previous by thread: Re: Is jQuery worth a second look?
- Next by thread: Re: Is jQuery worth a second look?
- Index(es):
Relevant Pages
|