1. #1
    Sencha Premium Member
    Join Date
    Jun 2012
    Location
    Auckland, New Zealand
    Posts
    6
    Vote Rating
    1
    walter.rumsby is on a distinguished road

      0  

    Default Answered: [4.1.0] Cannot toggleCls on document Element

    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
    16,639
    Answers
    431
    Vote Rating
    582
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      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
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

Thread Participants: 1

Tags for this Thread