Skip to content

Commit

Permalink
add allow attributes to parse
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanlntn committed Sep 23, 2013
1 parent 94fee4c commit 7dd6d75
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions vendor/assets/javascripts/wysihtml5.js
Original file line number Diff line number Diff line change
Expand Up @@ -4899,6 +4899,7 @@ wysihtml5.dom.parse = (function() {
var attributes = {}, // fresh new set of attributes to set on newNode
setClass = rule.set_class, // classes to set
addClass = rule.add_class, // add classes based on existing attributes
allowAttributes = rule.allow_attributes, // copy attributes from old to new node
setAttributes = rule.set_attributes, // attributes to set on the current node
checkAttributes = rule.check_attributes, // check/convert values of attributes
allowedClasses = currentRules.classes,
Expand All @@ -4918,6 +4919,17 @@ wysihtml5.dom.parse = (function() {
if (setAttributes) {
attributes = wysihtml5.lang.object(setAttributes).clone();
}

if (allowAttributes) {
allowAttributesLength = allowAttributes.length;
for (i = 0; i<allowAttributesLength; i++) {
attributeName = allowAttributes[i];
newAttributeValue = _getAttribute(oldNode, attributeName);
if (typeof(newAttributeValue) === "string") {
attributes[attributeName] = newAttributeValue;
}
}
}

if (checkAttributes) {
for (attributeName in checkAttributes) {
Expand Down

0 comments on commit 7dd6d75

Please sign in to comment.