Opened 9 years ago

Closed 9 years ago

#11807 closed enhancement (fixed)

[patch] Make HTML fragment check in dojo.place() whitespace-tolerant

Reported by: Thomas Bachem Owned by: Eugene Lazutkin
Priority: high Milestone: 1.6
Component: HTML Version: 1.5
Keywords: Cc:
Blocked By: Blocking:

Description

dojo.place() currently determines whether its first argument is a HTML fragment or a DOM ID by just looking if the first character is a "<".

This leads to confusing problems if the string begins with a whitespace character, e.g. " <strong>foo</strong>".

So line 264 in dojo/_base/html.js should be changed from

node = node.charAt(0) == "<" ? d._toDom(node, refNode.ownerDocument) : byId(node);

to

node = /^\s*</.test(node) ? d._toDom(node, refNode.ownerDocument) : byId(node);

to ignore any whitespace characters at the beginning.

Change History (2)

comment:1 Changed 9 years ago by Eugene Lazutkin

Milestone: tbd1.6
Owner: changed from sjmiles to Eugene Lazutkin
Status: newassigned

comment:2 Changed 9 years ago by Eugene Lazutkin

Resolution: fixed
Status: assignedclosed

(In [23737]) base: better check for a DOM fragment in dojo.place(), thx thomasbachem!, !strict, fixes #11807.

Note: See TracTickets for help on using tickets.