Closed Bug 162744 Opened 22 years ago Closed 22 years ago

JavaScript strings do not contain elements and their contents

Categories

(Core :: XSLT, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: inigosurguy, Assigned: peterv)

Details

Attachments

(2 files)

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1b) Gecko/20020814
BuildID:    2002081409


Elements and their contents are not being correctly copied into JavaScript
strings, only text nodes that are outside elements. This is not the case in
normal HTML.

For example, 
  alert("<xsl:call-template name="test1"/>");
  
  <xsl:template name="test2">before<h2>headingtext</h2>after</xsl:template>

produces "beforeafter" and misses the <h2> and the headingtext.

I've confirmed the correct behaviour in Xalan and in MSXML.

It's possible to workaround this bug with copious use of CDATA sections.

Reproducible: Always
Steps to Reproduce:
1. See attachments
Attached file The XML file
You should not create childelements of a <script>. You should create the
resulting *tree* that you want, not the serialization that you want.

What happens is that you create a child h2-element of the script, when the
script then executes it just grabs all the text-children and concatinate those
and execute, childelements are ignored. Agreeably this is debateable if it is
the right behavious, we shold maybe just refuse to execute the script entierly.
The resulting output is not valid html so no spec defines the behaviour.

Compliments for a very nice way of attaching the testcase though!! I wish more
people would do it this way.
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
Summary: JavaScript strings do not contain elements and their contents → JavaScript strings do not contain elements and their contents
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: