0
votes

I have this: A bit of javascript that is supposed to inject colored dots.. it works in Chrome, but in firefox the dots just turn out black.

$('.dotholder').html('<p><span style="color:red;">'+"&#8226;"+"</span>");

but no matter what I put in for color, what I put the dots are always black. I looked at the firefox HTML tree via firebug, and it looks like firefox is wrapping

<a xmlns="http://www.w3.org/1999/xhtml"></a> 

tags around my dots.

EDIT:

I set a breakpoint, and everything is fine until it hits that line, then all of the sudden an a tag gets wrapped around it. Also, my original script had a closing p tag, I dont know how i lost it when I copied it over. But yes, my code has a /p

I am using 3.6.13

EDIT 2: I removed the explicit "http://www.w3.org/1999/xhtml" attribute from my HTML tag, but the a tags still have it.

1
You are not closing the <p>?Pekka
@DantheMan Quickly running $("body").prepend($("<p />").html('<span style="color:red;">&#8226</span>')) from the address bar doesn't seem to produce any problems. Perhaps reduce the number of string breaks and add a closing </p> just in case, even if it's not required. No idea if that might be the trouble.lsuarez
work as well on FF 3.6.15, maybe some !important css rules ?Sven Koluem
Works in Firefox 3.6.13 too. Firebug shows that the markup has been inserted correctly. Why not use firebug to inspect the element and make sure it's what you requested. If not it may give you some idea as to what has happened. I've got no idea how you could have got that weird anchor though!Neil
The text "xmlns="w3.org/1999/xhtml" is the "namespaceURI" that is implicitly (or explicitly) part of the HTML tag. Goodness knows how it got included. I can only suggest that you try setting a breakpoint with firebug at the point the replacement takes place and have a look at some of the variables.Neil

1 Answers

2
votes

Works for me in Firefox 3.6, the dot is red... I'm using Mac. Here's my test code:-

<html>
    <head>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
    </head>
    <body>
        <div class="dotholder" />
        <script>
            $(document).ready(function(){
                $('.dotholder').html('<p><span style="color:red;">'+"&#8226;"+"</span>");
            });
        </script>
    </body>
</html>