Opened 12 years ago

Closed 11 years ago

#11807 closed enhancement (fixed)

[patch] Make HTML fragment check in 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 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);


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 12 years ago by Eugene Lazutkin

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

comment:2 Changed 11 years ago by Eugene Lazutkin

Resolution: fixed
Status: assignedclosed

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

Note: See TracTickets for help on using tickets.