Skip to content

Commit

Permalink
cuando genera atributos con raya-asi las genera bien en el DOM con cr…
Browse files Browse the repository at this point in the history
…eate
  • Loading branch information
Emilio authored and Emilio committed Jan 6, 2016
1 parent 58354f4 commit 98df4de
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
16 changes: 10 additions & 6 deletions js-to-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -1032,13 +1032,17 @@ jsToHtml.Html.prototype.create = function create(){
/*jshint -W089 */
Object.keys(this.attributes).map(function(attr){
var value=this.attributes[attr];
var defAttr=jsToHtml.htmlAttrs[attr]||{};
if(('listType' in defAttr) && (typeof value!=="string")){
Array.prototype.forEach.call(value,function(subValue){
element[defAttr.listType].add(subValue);
});
if(/-/.test(attr)){
element.setAttribute(attr, value);
}else{
element[defAttr.domName||attr] = value;
var defAttr=jsToHtml.htmlAttrs[attr]||{};
if(('listType' in defAttr) && (typeof value!=="string")){
Array.prototype.forEach.call(value,function(subValue){
element[defAttr.listType].add(subValue);
});
}else{
element[defAttr.domName||attr] = value;
}
}
},this);
this.content.forEach(function(node){
Expand Down
7 changes: 7 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,13 @@ if(typeof document !== 'undefined'){
done
);
});
it('should define special dashed attributes', function(done){
control(
html.p({"one-special-attr":'the value'}),
'<p one-special-attr="the value"></p>',
done
);
});
});
});
}

0 comments on commit 98df4de

Please sign in to comment.