Skip to content

Commit

Permalink
Adjust currentAttr.name (fix inikulin#318)
Browse files Browse the repository at this point in the history
  • Loading branch information
calvinjuarez committed Jun 24, 2020
1 parent 2e33574 commit 62f7a59
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/parse5/lib/common/foreign-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const MIME_TYPES = {
//Attributes
const DEFINITION_URL_ATTR = 'definitionurl';
const ADJUSTED_DEFINITION_URL_ATTR = 'definitionURL';
const SVG_ATTRS_ADJUSTMENT_MAP = {
const SVG_ATTRS_ADJUSTMENT_MAP = (exports.SVG_ATTRS_ADJUSTMENT_MAP = {
attributename: 'attributeName',
attributetype: 'attributeType',
basefrequency: 'baseFrequency',
Expand Down Expand Up @@ -76,7 +76,7 @@ const SVG_ATTRS_ADJUSTMENT_MAP = {
xchannelselector: 'xChannelSelector',
ychannelselector: 'yChannelSelector',
zoomandpan: 'zoomAndPan'
};
});

const XML_ATTRS_ADJUSTMENT_MAP = {
'xlink:actuate': { prefix: 'xlink', name: 'actuate', namespace: NS.XLINK },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const Mixin = require('../../utils/mixin');
const Tokenizer = require('../../tokenizer');
const PositionTrackingPreprocessorMixin = require('../position-tracking/preprocessor-mixin');
const SVG_ATTRS_ADJUSTMENT_MAP = require('../../common/foreign-content').SVG_ATTRS_ADJUSTMENT_MAP;

class LocationInfoTokenizerMixin extends Mixin {
constructor(tokenizer) {
Expand Down Expand Up @@ -37,7 +38,9 @@ class LocationInfoTokenizerMixin extends Mixin {
currentToken.location.attrs = Object.create(null);
}

currentToken.location.attrs[currentAttr.name] = this.currentAttrLocation;
const name = SVG_ATTRS_ADJUSTMENT_MAP[currentAttr.name] || currentAttr.name;

currentToken.location.attrs[name] = this.currentAttrLocation;
}

_getOverriddenMethods(mxn, orig) {
Expand Down

0 comments on commit 62f7a59

Please sign in to comment.