innerHTML property of script tag is empty after XSLT transform

RESOLVED INCOMPLETE

Status

()

Core
XSLT
RESOLVED INCOMPLETE
2 years ago
a year ago

People

(Reporter: rodrick, Unassigned)

Tracking

43 Branch
x86_64
Windows 8.1
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

1.96 KB, application/x-zip-compressed
Details
1.02 KB, application/zip
Details
(Reporter)

Description

2 years ago
Created attachment 8711530 [details]
boot.zip

User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36

Steps to reproduce:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml"
  xmlns:xhtml="http://www.w3.org/1999/xhtml">

  <xsl:output  doctype-system="about:legacy-compat" omit-xml-declaration="yes" indent="yes" method="html" media-type="application/html" encoding="utf-8"  />

  <xsl:template match="/">
    <xsl:apply-templates />
  </xsl:template>

  <xsl:template match="head">

    <head>

      <script id="foo" type="text/template">

        <h1>Hello, world.</h1>

      </script>


      <script type="text/javascript" src="/js/main.js"></script>
    </head>
  </xsl:template>

  <xsl:template match="*">
    <xsl:copy>
      <xsl:for-each select="./@*">
        <xsl:copy />
      </xsl:for-each>
      <xsl:apply-templates />
    </xsl:copy>
  </xsl:template>


</xsl:stylesheet>




The contents of "main.js" is


document.addEventListener('readystatechange', function ()
{
    if(this.readyState == 'complete')
    {
        var s = document.getElementById('foo');

        console.log(s.innerHTML);


        document.body.style.display = 'block';
    }


});


Actual results:

console.log(s.innerHTML) in the aforementioned script results in a whitespace string being written to the console.


Expected results:

Expected the contents of the 'foo' script tag: "<h1>Hello, world.</h1>".

The desktop versions of Chrome 48.0.2564.82 m and IE 11.0.9600.18161 running on Windows; and Safari 8.0.8 running on Yosemite yield the expected results.

Updated

2 years ago
Component: Untriaged → Untriaged
Product: Firefox → Core

Comment 1

2 years ago
When loading n.xhtml in FF43, I see nothing in the console output. Could you explain what we should see?
Flags: needinfo?(rodrick)
Verified on the latest Nighlty 48.0a1 and FF Release 45.0, and, as Loic said, did not see anything in the console  output.

Marking this as Resolved: Incomplete due to the lack of response from the reporter.
If anyone can still reproduce it on latest versions, feel free to reopen the issue and provide more information.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 2 years ago
Flags: needinfo?(rodrick)
OS: Unspecified → Windows 8.1
Hardware: Unspecified → x86_64
Resolution: --- → INCOMPLETE

Comment 3

a year ago
Created attachment 8879322 [details]
test.zip

Hello guys. I'm afraid that bug still presents in version 54.0 (32-bit).

Put test.xml, test.js and test.xsl in virtual folder. Open http://virtual_folder/test.xml file in FF.

Expects "Hello world" on page (it works in Chrome and IE 11)
Actualy there are no "Hello world" because document.getElementById('template').innerHTML returns empty string.

If template content located in static <script> (without xslt) FF works fine.

It's very annoying bug makes useless a templates api like jsrender (https://www.jsviews.com/), jquery.template and etc.
Component: Untriaged → XSLT

Comment 4

a year ago
(In reply to Brindusa Tot[:brindusat] from comment #2)
> If anyone can still reproduce it on latest versions, feel free to reopen the
> issue and provide more information.
Hi Brindusa, should I create dublicate of this bug or someone can reopen this one?
You need to log in before you can comment on or make changes to this bug.