I am currently parsing through a WMS Capabilities XML file using selectors and this works great, nice clean code solution.
However I have stumbled across an issue with IE8- (Chrome, Safari, Firefox etc all working perfectly)
$.get(capabilitiesUrl, function (data) {
$("WMT_MS_Capabilities Capability Layer Layer Name", $(data)).not("Style Name").each(function (i) {
layerNames[i] = $(this).text();
});
});
This will successfully populate my array of layerNames
in the decent browsers.
In IE9+ data
is type of [Object, Document]
However in IE8- the type of data
is a type of IXMLDOMDocument2
which I can't parse with the selector query.
The IXMLDOMDocument2
is also read only causing sizzle to throw an exception on:
outerCache = elem[ expando ] || (elem[ expando ] = {});
as it will try to run through elem[ expando ] = {}
which fails as the IXMLDOMDocument2
is read only. With a Object doesn't support this property or method
error.
Is there a way for me to populate my layerNames
array using selectors or am I chasing the impossible?
Figured this one out.
If you use the .find()
instead of the find in
method it will parse properly in IE8-
Then I still had the issue of the .not()
causing the exception in sizzle
.
I solved this by instead of using the jQuery
API of .not()
to using the :not()
selector.
The solution is as follows:
$(data).find("WMT_MS_Capabilities Capability Layer Layer Name:not(Style Name)").each(function (i) {
layerNames[i] = $(this).text();
});