jeudi 29 octobre 2015

jquery val update with trigger change of input field not seen by ember

I have a Chrome extension that takes a userid/password and then passes it to a content script that runs in another tab to log in to that site. The content script uses jquery to programmatically update the userid and password fields and then click the login button. This worked fine until the login screen was rewritten with Ember.

Now, the login button is not active until inputs are seen in the userid/password fields. The jquery .val() function updates the fields but the app apparently has an Ember bind for change to activate the login button when both fields have text. The .val() update does not trigger the change. I have tried two approaches and can not get either to work.

  1. I added .trigger('change') but that doesn't seem to get noticed by ember. At least the login button does not become active.

  2. I tried adding Ember.View.views['emberxxxx'].set() which works in the debug console but not in my Chrome content script. I get error "TypeError: Cannot read property 'views' of undefined". I wonder if I need to define something more to get this statement to work. I do have ember.prod.js defined in JS in my manifest file, but nothing else. I am very Ember-challenged.

Any advice is appreciated!

Thanks, Doug




Aucun commentaire:

Enregistrer un commentaire