Re: createTextNode vs INVALID_CHARACTER_ERR

>I just discovered that DOM L2's createTextNode doesn't declare a
>DOMException.

That's deliberate. Checking every character of every text operation would
be a significant computational expense, and in many cases entirely
unnecessary since the application software may already have ensured that
the data is valid. Hence -- as with some of the other operations -- the DOM
does _not_ continuously enforce well-formedness of text node contents.

DOM Level 3 is planning to define operations that perform more intensive
well-formedness checks, and _may_ include a mode in which validity and
well-formedness are checked continuously. This is still under design, and
may be an optional Feature not present in all DOMs.

Until that design is finished, approved, and implemented, figure on
checking your own character data where and when that's necessary -- before
passing it into the DOM, or at serialization time.
______________________________________
Joe Kesselman  / IBM Research

Received on Friday, 27 July 2001 08:45:15 UTC