vendredi 10 avril 2015

Inline-if inside button triggers deprecation warning and error

I'm trying to bind whether a button is active or disabled on a computed property but get this depcreation warning and error afterwards.


This is troublesome button (Ember 1.11.1 here):



<button {{ action 'loadMore' }} {{if canLoadMore 'active' 'disabled'}}>Load More Posts...</button>


This warnining and error:



DEPRECATION: Returning a string of attributes from a helper inside an element is deprecated.
Uncaught TypeError: Cannot read property 'replace' of undefined


on this function:



if (value) {
Ember['default'].deprecate('Returning a string of attributes from a helper inside an element is deprecated.');

var parts = value.toString().split(/\s+/);
for (var i = 0, l = parts.length; i < l; i++) {
var attrParts = parts[i].split('=');
var attrName = attrParts[0];
var attrValue = attrParts[1];

attrValue = attrValue.replace(/^['"]/, '').replace(/['"]$/, '');

env.dom.setAttribute(domElement, attrName, attrValue);
}




Aucun commentaire:

Enregistrer un commentaire