[OpenLayers-Users] IE8 error when adding a vector layer

Amos Hayes ahayes at gcrc.carleton.ca
Fri Mar 20 15:01:05 EDT 2009


Well simply changing to -ms-behavior didn't work.

I then found two more leads:

 From http://code.google.com/p/explorercanvas/source/browse/trunk/excanvas.js

       if (!doc.namespaces['g_vml_']) {
         doc.namespaces.add('g_vml_', 'urn:schemas-microsoft-com:vml',
                            '#default#VML');


And here is what MS has to say, which confuses me since 'behavior' is  
supposedly gone:

Generic CSS Prefix Selectors

Generic CSS prefix selectors are no longer supported in IE8 Standards  
Mode in order to provide standards-compliant CSS parsing. Most often,  
this affects pages trying to use CSS to attach behaviors to VML  
elements. This can cause a script error if set dynamically, or a  
silent failure when hard-coded into the CSS of a page. Ultimately the  
rule is not applied, leading to effects such as VML not displaying on  
a page.
SOLUTION: Explicitly specify each tag name you want to match when  
using CSS prefix selectors.
v\:* {
     behavior: url(#default#VML);
}

v\:polyline,
v\:line {
     behavior: url(#default#VML);
}


Then I tried changing line 793 to this and the error goes away, the  
Google background and transparent WMS layers load, but I have no  
points on it yet:

if(!document.namespaces.olv) 
{document.namespaces.add("olv",this.xmlns);var  
style=document.createStyleSheet();style.addRule('olv\ 
\:shape',"behavior: url(#default#VML); "+"position: absolute; display:  
inline-block;");}

I looked through OpenLayers.js for all the possible olv\\:*  
possibilities and put them all in. Looks like maybe shape, rect, oval,  
fill, stroke, imagedata, and group. Any others that I might have  
missed in my search?

Anyway, now I have my points showing up and I can hover/click on them  
- but they are ovals and mis-positioned SE of where they ought to be.  
At this point, I'm wondering if someone else who knows what might be  
going on with projection could pick up the torch.

I'll attach the patch to the ticket.
http://trac.openlayers.org/ticket/1910

--
Amos Hayes
Geomatics and Cartographic Research Centre
Carleton University
ahayes at gcrc.carleton.ca
+1.613.520.2600x8179

On 20-Mar-09, at 11:44 AM, Christopher Schmidt wrote:

> On Fri, Mar 20, 2009 at 11:33:40AM -0400, Amos Hayes wrote:
>>
>> There was already an OL bug filed which points to VML problems as a
>> result of the same error. I have added the specific error info to it.
>>
>> http://trac.openlayers.org/ticket/1910
>>
>> I'm still suspicious about the fact that the rule falls in a CSS
>> styling problem.
>>
>> Digging in, it looks like the "behavior" property has been changed to
>> "-ms-behavior", which tickles me a bit. :)
>>
>> http://msdn.microsoft.com/en-us/library/ms530723(VS.85).aspx
>
> If someone can confirm that changing the current OL code from  
> 'behavior'
> to '-ms-behavior' actually works, that would be nice, though I'm still
> not 100% convinced that would mean we'd get it in 2.8.
>
> Regards,
> -- 
> Christopher Schmidt
> MetaCarta




More information about the Users mailing list