st-h / ember-content-editable

A contenteditable component for ember-cli that just works™
MIT License
66 stars 31 forks source link

Update content-editable.js #17

Closed bttf closed 8 years ago

bttf commented 8 years ago

According to this jQuery bug https://bugs.jquery.com/ticket/13666 and also the docs for .text() http://api.jquery.com/text/#text2 , passing in null or undefined is not valid input for the .text() method. This change avoids passing in either values.

In the latest jQuery, nulls and undefineds are handled as regular no-ops, albeit they are undocumented (save for above links). But in past versions, the behavior is less predictable - in as recent as 1.11.3, passing in null will return a string 'null'.

Currently, we are embedding our ember app in a legacy web app, and are running into this minor complication. Refining the way we use .text() can help us in this situation and also help adhere more strictly to jQuery docs.

chrissloey commented 8 years ago

Hey, sorry for the delay responding here. Looks like this is causing a test failure with this kind of usage:

    {{#content-editable}}
      template block text
    {{/content-editable}}

I guess it's because the change is setting the text to an empty string, and by what you've said it would have been a no-op before.

chrissloey commented 8 years ago

Closing this since it's been a while.