Weird ExtJS 2.0 Code

A

Aaron Gray

What the hell is going on in source/adapter/ext-base.js on lines 36 and 45,
Ext.lib.Dom.getViewportHeight and Width ?

It seems to be using 'self' which seems to come from no where ?

Also whats going on with checking 'document.compatMode != "CSS1Compat" '
when addressing using 'document.documentElement' rather than 'document.body'
in Ext.lib.Dom.getDocumentWidth and getDocumentHeight. Then in
getViewportHeight and Width Ext.isStrict is also a test for
'document.compatMode != "CSS1Compat" '.

Strange stuff, any shed some light on these two matters !

Aaron
 
M

Martin Honnen

Aaron said:
What the hell is going on in source/adapter/ext-base.js on lines 36 and 45,
Ext.lib.Dom.getViewportHeight and Width ?

It seems to be using 'self' which seems to come from no where ?

You will need to post the URL to the code if you want us to look at it.
self in the browser object model is usually an alias for window.
Also whats going on with checking 'document.compatMode != "CSS1Compat" '
when addressing using 'document.documentElement' rather than 'document.body'
in Ext.lib.Dom.getDocumentWidth and getDocumentHeight. Then in
getViewportHeight and Width Ext.isStrict is also a test for
'document.compatMode != "CSS1Compat" '.

IE 6 introduced two rendering modes, quirks mode and standards mode. And
it exposed document.compatMode to test for that where I think the
possible values are 'BackCompat' and 'CSS1Compat'. Other browsers have
that too by now.
 
A

ajaxexample

What the hell is going on in source/adapter/ext-base.js on lines 36 and 45,
Ext.lib.Dom.getViewportHeight and Width ?

It seems to be using 'self' which seems to come from no where ?

Also whats going on with checking 'document.compatMode != "CSS1Compat" '
when addressing using 'document.documentElement' rather than 'document.body'
in Ext.lib.Dom.getDocumentWidth and getDocumentHeight. Then in
getViewportHeight and Width Ext.isStrict is also a test for
'document.compatMode != "CSS1Compat" '.

Strange stuff, any shed some light on these two matters !

Aaron

That use of self looks incorrect! Usually people do `var self = this;`
and I found that other places in the code, but in ext-base.js it looks
like it's being used without getting set. Does that throw an error?

Ajax Example ::: http://ajaxexample.net
 
A

Aaron Gray

Martin Honnen said:
You will need to post the URL to the code if you want us to look at it.
self in the browser object model is usually an alias for window.
http://extjs.com


IE 6 introduced two rendering modes, quirks mode and standards mode. And
it exposed document.compatMode to test for that where I think the possible
values are 'BackCompat' and 'CSS1Compat'. Other browsers have that too by
now.

Yes I gathered that but what does that have to do with using
document.documentElement rather than document.body ?

Aaron
 
A

Aaron Gray

That use of self looks incorrect! Usually people do `var self = this;`
and I found that other places in the code, but in ext-base.js it looks
like it's being used without getting set. Does that throw an error?

Yes thats what I thought. I have not written any test code that
specifically, but ExtJS works fine and dose not seem to throw any browser
errors when in use.

Aaron
 
M

Martin Honnen

Aaron said:
Yes I gathered that but what does that have to do with using
document.documentElement rather than document.body ?

In quirks mode IE uses document.body (the body element) as the canvas,
in standards mode document.documentElement (the html element).
 
A

Aaron Gray

Martin Honnen said:
In quirks mode IE uses document.body (the body element) as the canvas, in
standards mode document.documentElement (the html element).

Right, thanks.

Aaron
 
T

Thomas 'PointedEars' Lahn

What the hell is going on in source/adapter/ext-base.js on lines 36 and
45, Ext.lib.Dom.getViewportHeight and Width ?

It seems to be using 'self' which seems to come from no where ? [...]

Please trim your quotes to the parts that you are referring to.
That use of self looks incorrect!

It is certainly unwise, but not incorrect.
Usually people do `var self = this;` and I found that other places in the
code, but in ext-base.js it looks like it's being used without getting
set. Does that throw an error?

It would throw a ReferenceError exception if there was no object in the
scope chain to have such a property. After all, the `self' property of
Window objects (which would refer to its owner), and Window objects
themselves, are proprietary and host-dependent features.
Ajax Example ::: [URI]

Don't.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top