[cla][patch] Safari and dijit.Editor

Hi there!

I posted some Patches back in 2006 to get Editor2 working with Safari – and now I’m at it again for dijit.Editor ­čÖé

So far, I’ve managed to get Font-Formatting and Alignment working, mainly by preventing Safari from losing the selection on click.

I’ve also implemented a Html-Source editing plugin, which I’m happy to share if you’re interested. For that I needed to fix RichText#replaceValue?() – is there any particular reason why there is no catch-all that just hands the call off to setValue?

Finally I had an issue where Safari would only display the text-value, with all html-formatting stripped.

I’m attaching a patch with these three changes.

thanks for any feedback you can give me

cheers, Hannes

Safari: dijit.Editor dies while creating an unlabelled Button

Hi all! I’m working towards getting dijit.Editor usable in Safari.

In dijit.form.Button:postCreate, the following call to dojo.trim fails:

dojo.trim(this.containerNode.innerText || this.containerNode.textContent);

The reason for this is that in Safari this.containerNode.innerText returns an empty string. Safari then proceeds with this.containerNode.textContent and passes the result of this second call (undefined) to dojo.trim, where no typechecking is done and the call to undefined.replace fails. Unfortunately this transcends my javascript-foo. What’s the canonical way to work around that kind of problem? (it seems that Safari treats an empty String as a false-value – is this a bug in Safari?) However, if I explicitly cast the argument, I get a step further:

dojo.trim(String(” || undefined))

Possible patch is attached.

Thanks in advance for your feedback, Hannes