Opened 8 years ago

Closed 8 years ago

#13367 closed defect (wontfix)

[regression] dojo.hasClass (dom/class.contains) crashed if passed DomNode is a Text node

Reported by: cjolif Owned by: Eugene Lazutkin
Priority: high Milestone: 1.7
Component: HTML Version: 1.7.0b1
Keywords: Cc:
Blocked By: Blocking:

Description

See #13366 for a dojox.mobile sample that highlights this issue. Obviously a Text node can't have a class however we used to not crash in that case and I guess simply return false. I would say we should not create an compatibility here and keep previous behavior. This was recently introduced in [25723].

Change History (1)

comment:1 Changed 8 years ago by Eugene Lazutkin

Resolution: wontfix
Status: newclosed

As a policy we don't provide extensive validation if input parameters, opting for GIGO and "fail early" approaches. Text nodes "worked" before not by design (as you can imagine) but by a pure luck --- they should not work with majority of our API including dojo.byId(), which is used universally. Given all that I suggest to implement text node checks in the user code locally, rather than increase our core codebase to cater for such rare event decreasing the overall performance in the process.

Note: See TracTickets for help on using tickets.