By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,287 Members | 1,668 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,287 IT Pros & Developers. It's quick & easy.

Weird ExtJS 2.0 Code

P: n/a
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
Aug 14 '08 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Aaron Gray wrote:
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.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 14 '08 #2

P: n/a
On Aug 14, 11:33 am, "Aaron Gray" <ang.use...@gmail.comwrote:
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
Aug 14 '08 #3

P: n/a
"Martin Honnen" <ma*******@yahoo.dewrote in message
news:48***********************@newsspool4.arcor-online.net...
Aaron Gray wrote:
>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.
http://extjs.com
>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.
Yes I gathered that but what does that have to do with using
document.documentElement rather than document.body ?

Aaron
Aug 14 '08 #4

P: n/a
<aj*********@gmail.comwrote in message
news:bf**********************************@f63g2000 hsf.googlegroups.com...
On Aug 14, 11:33 am, "Aaron Gray" <ang.use...@gmail.comwrote:
>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?
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
Aug 14 '08 #5

P: n/a
Aaron Gray wrote:
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).

--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 15 '08 #6

P: n/a
"Martin Honnen" <ma*******@yahoo.dewrote in message
news:48***********************@newsspool2.arcor-online.net...
Aaron Gray wrote:
>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).
Right, thanks.

Aaron
Aug 15 '08 #7

P: n/a
aj*********@gmail.com wrote:
On Aug 14, 11:33 am, "Aaron Gray" <ang.use...@gmail.comwrote:
>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
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Aug 15 '08 #8

This discussion thread is closed

Replies have been disabled for this discussion.