-
20 Jun 2012 3:37 PM #1
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
- FF 13.0.1
- IE 9.0
- Chrome 19
- HTML5 DOCTYPE
- Ext.getDoc().toggleCls() throws a JavaScript error.
- Get the document element
- Call toggleCls on that element
- CSS class would be added/removed to the document element (<html>) in the same way it would be added/removed to other elements
- JavaScript error
See this URL for live test case: http://jsfiddle.net/wrumsby/KgGTp/Code:Ext.getDoc().toggleCls('yellow');
Operating System:
- Windows 7 Pro
-
Best Answer Posted by evant
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');
-
20 Jun 2012 4:31 PM #2Sencha - Ext JS Dev Team
- Join Date
- Apr 2007
- Location
- Sydney, Australia
- Posts
- 15,065
- Vote Rating
- 96
- Answers
- 166
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!


Reply With Quote