Bug 4616 - Setting nodeValue on a textnode with collapsed whitespace only has no visual effect
Summary: Setting nodeValue on a textnode with collapsed whitespace only has no visual ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 312.x
Hardware: Macintosh OS X 10.3
: P2 Normal
Assignee: Alexey Proskuryakov
URL: http://crschmidt.net/projects/webkit/...
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-23 23:25 PDT by Christopher Schmidt
Modified: 2006-03-28 20:20 PST (History)
0 users

See Also:


Attachments
proposed fix (3.01 KB, patch)
2006-03-26 07:36 PST, Alexey Proskuryakov
mjs: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Schmidt 2005-08-23 23:25:38 PDT
Whitespace in HTML is ill-defined: whether it defines a text node or not is up
to implementation authors. It seems that Safari/Webkit defines a nodeValue for
nodes like:

<div> </div> (whitespace inbetween) -- however, it is not possible to set the
nodeValue of this firstChild of the div element.

The URI above demonstrates this problem: Opera 8.10 and Firefox 1.0 both will
add "bar" text to the document, IE will simply return "whitespace is not
significant" -- but Safari will pop up the "bar" alert, but not actually add the
text.
Comment 1 Mark Rowe (bdash) 2005-09-07 01:35:56 PDT
Confirmed with WebKit 412.7 and ToT WebKit.
Comment 2 Alexey Proskuryakov 2006-03-26 07:36:42 PST
Created attachment 7308 [details]
proposed fix

Is there a better way to create a missing renderer than detach()/attach()?
Comment 3 Justin Garcia 2006-03-26 19:32:09 PST
createRendererIfNeeded?
Comment 4 Darin Adler 2006-03-26 22:50:22 PST
Comment on attachment 7308 [details]
proposed fix

This does seem a little brute force. It's not immediately obvious to me if there's a better solution -- I'll have to research this later.
Comment 5 Maciej Stachowiak 2006-03-28 15:15:45 PST
This actually seems ok to me as a way to create a missing renderer. createRenderIfNeeded might work, but normally renderers are only created at attach time and there doesn't seem to be a huge reason to step away from that, since this is an unusual situation.