querySelectorAll IE8

209 views
Skip to first unread message

Mohit

unread,
Aug 1, 2012, 2:19:34 AM8/1/12
to google-we...@googlegroups.com
Hey guys,

I am facing a strange problem related to CSS query selector in IE8. I am using standard HTML Doctype.

Sample HTML:
<div id="container">
    <input id="field" type="text" />
</div>
The container div is a HTMLPanel.

GWT Native Code:
private static native NodeList<Element> nativeQuery(Element root, String query)/*-{
        var root = obj || $doc;
        return root.querySelectorAll(query);
}-*/

If I use this code like nativeQuery(getElement(), "#field") where getElement() is the root element of HTMLPanel, it complains in IE8 saying object doesn't support this property.

Plain Javascript Code:
var list = document.getElementById('container').querySelectorAll('#field');
alert(list);

This code runs fine in IE8 and returns me a nodelist containing 1 element.

Can anybody suggest what is the problem with my GWT native method?

Thanks,
Mohit



Mohit

unread,
Aug 1, 2012, 2:48:46 AM8/1/12
to google-we...@googlegroups.com

There is a typo in GWT native code in my earlier post. Please refer the method below:

GWT Native Code:
private static native NodeList<Element> nativeQuery(Element root, String query)/*-{
       return root.querySelectorAll(query);
}-*/

I am using GWT 2.3

Thanks,
Mohit
Reply all
Reply to author
Forward
0 new messages