On 10 Feb 2009, at 22:51, Marc Palmer wrote:


Hi,

Forgive me as I'm a total jQuery n00b. However, I am rather confused.

I have the following trivial code:

<html>
<head>
        <script src="jquery-1.3.1.min.js" type="text/javascript"/>
        <script type="text/javascript">
        $(document).ready(function () {
            $("p").text("The DOM is now loaded and can be manipulated.");
        });
        </script>
</head>
<body>

        <p>
        </p>
</body>
</html>

This is effectively lifted from the ready() documentation page
http://docs.jquery.com/Events/ready#fn

This code works fine in Safari 3 on my machine. It does not work at
all in Firefox 2.x on the same machine. However... the documentation
page -does- do the substitution fine.

More importantly, the firefox problem is just a distraction because I
find the same behaviour (text replacement not working) when I run
HtmlUnit (2.5 snapshot) tests in Java with the same HTML above.


FYI this is because there is no DOCTYPE and the /> on the first script tag confuses the parser in ffx2 / htmlunit which means it doesn't include the 2nd script tag. Safari seems to be bug in that it assumes the document is valid HTML.

~ ~ ~
Marc Palmer
Blog         > http://www.anyware.co.uk
Twitter      > http://twitter.com/wangjammer5
Grails Rocks > http://www.grailsrocks.com





Reply via email to