Results 1 to 2 of 2

Thread: [4.1.0] Cannot toggleCls on document Element

  1. #1
    Sencha Premium Member
    Join Date
    Jun 2012
    Location
    Auckland, New Zealand
    Posts
    6
    Vote Rating
    2
      0  

    Default Answered: [4.1.0] Cannot toggleCls on document Element

    Ext version tested:
    • Ext 4.1.0

    Browser versions tested against:

    • FF 13.0.1
    • IE 9.0
    • Chrome 19

    DOCTYPE tested against:
    • HTML5 DOCTYPE

    Description:
    • Ext.getDoc().toggleCls() throws a JavaScript error.

    Steps to reproduce the problem:
    • Get the document element
    • Call toggleCls on that element

    The result that was expected:
    • CSS class would be added/removed to the document element (<html>) in the same way it would be added/removed to other elements

    The result that occurs instead:
    • JavaScript error

    Test Case:

    Code:
    Ext.getDoc().toggleCls('yellow');
    See this URL for live test case: http://jsfiddle.net/wrumsby/KgGTp/

    Operating System:

    • Windows 7 Pro

  2. This is the expected behaviour. getDoc() refers to the document, not the html element.

    You'll want to use:

    Code:
    Ext.getBody().parent().toggleCls('foo');
    // or
    Ext.getDoc().first().toggleCls('foo');

  3. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    18,590
    Answers
    674
    Vote Rating
    873
      0  

    Default

    This is the expected behaviour. getDoc() refers to the document, not the html element.

    You'll want to use:

    Code:
    Ext.getBody().parent().toggleCls('foo');
    // or
    Ext.getDoc().first().toggleCls('foo');
    Evan Trimboli
    Twitter - @evantrimboli

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •