Weird ExtJS 2.0 Code

Discussion in 'Javascript' started by Aaron Gray, Aug 14, 2008.

  1. Aaron Gray

    Aaron Gray Guest

    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
    Aaron Gray, Aug 14, 2008
    #1
    1. Advertising

  2. 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/
    Martin Honnen, Aug 14, 2008
    #2
    1. Advertising

  3. Aaron Gray

    Guest

    On Aug 14, 11:33 am, "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 ?
    >
    > 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, 2008
    #3
  4. Aaron Gray

    Aaron Gray Guest

    "Martin Honnen" <> wrote in message
    news:48a46271$0$20715$-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
    Aaron Gray, Aug 14, 2008
    #4
  5. Aaron Gray

    Aaron Gray Guest

    <> wrote in message
    news:...
    > On Aug 14, 11:33 am, "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 ?
    >>
    >> 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
    Aaron Gray, Aug 14, 2008
    #5
  6. 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/
    Martin Honnen, Aug 15, 2008
    #6
  7. Aaron Gray

    Aaron Gray Guest

    "Martin Honnen" <> wrote in message
    news:48a55e61$0$12942$-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
    Aaron Gray, Aug 15, 2008
    #7
  8. wrote:
    > On Aug 14, 11:33 am, "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 ? [...]


    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
    Thomas 'PointedEars' Lahn, Aug 15, 2008
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dorayme
    Replies:
    1
    Views:
    610
    richard
    Jan 21, 2011
  2. richard
    Replies:
    0
    Views:
    576
    richard
    Jan 21, 2011
  3. Gurpal 2000

    json for extjs (without rails)

    Gurpal 2000, Sep 7, 2008, in forum: Ruby
    Replies:
    13
    Views:
    207
    Mark Thomas
    Sep 26, 2008
  4. Bhavesh Sharma

    Selecting row under Grid for EXTJS code

    Bhavesh Sharma, May 3, 2009, in forum: Ruby
    Replies:
    2
    Views:
    251
    Bhavesh Sharma
    May 4, 2009
  5. simon

    LEAD ExtJS/JAVAScripits/UI Developer

    simon, Aug 1, 2008, in forum: Javascript
    Replies:
    1
    Views:
    128
    John G Harris
    Aug 2, 2008
Loading...

Share This Page