Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Commit

Permalink
fix: for FB Creatives (#301)
Browse files Browse the repository at this point in the history
* new regex fixed for FB

* FB Creatives supported
  • Loading branch information
marco authored and jnewman-sfdc committed Jun 6, 2017
1 parent 56fb540 commit c7e3d94
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/streamReaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {CommentToken, CharsToken, StartTagToken,
* @type {Object}
*/
const REGEXES = {
startTag: /^<([\-A-Za-z0-9_]+)((?:\s+[\w\-]+(?:\s*=?\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,
endTag: /^<\/([\-A-Za-z0-9_]+)[^>]*>/,
startTag: /^<([\-A-Za-z0-9_!:]+)((?:\s+[\w\-]+(?:\s*=?\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,
endTag: /^<\/([\-A-Za-z0-9_:]+)[^>]*>/,
attr: /(?:([\-A-Za-z0-9_]+)\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))|(?:([\-A-Za-z0-9_]+)(\s|$)+)/g,
fillAttr: /^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noresize|noshade|nowrap|readonly|selected)$/i
};
Expand Down
4 changes: 4 additions & 0 deletions test/unit/tags.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ describe('HtmlParser (tags)', () => {
expect(s).to.equal('');
}));

it('parses closed FB tags completely', parsesCompletely('<fb:ad placementid="1234" format="320x50" testmode="true">FB</fb:ad>', s => {
expect(s).to.equal('<fb:ad placementid="1234" format="320x50" testmode="true">FB</fb:ad>');
}));

it('parses lower case tags', parses('<img src="http://localhost/">', (tok, str) => {
expect(tok).to.have.property('tagName', 'img');
expect(tok).to.have.property('type', 'startTag');
Expand Down

0 comments on commit c7e3d94

Please sign in to comment.