PDA

View Full Version : [4.1.0] Cannot toggleCls on document Element



walter.rumsby
20 Jun 2012, 3:37 PM
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:


Ext.getDoc().toggleCls('yellow');

See this URL for live test case: http://jsfiddle.net/wrumsby/KgGTp/

Operating System:


Windows 7 Pro

evant
20 Jun 2012, 4:31 PM
This is the expected behaviour. getDoc() refers to the document, not the html element.

You'll want to use:



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