Skip to content

Commit

Permalink
Now solving selectors containing namespace prefixes
Browse files Browse the repository at this point in the history
Fixes #27
  • Loading branch information
surdu committed Apr 3, 2018
1 parent b2e282f commit 2c773f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/selector-solver.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class SelectorSolver {
return null;
}

var tag = (/^[a-zA-Z][\w-]*/.exec(selector) || [])[0];
var tag = (/^[a-zA-Z][\w-:]*/.exec(selector) || [])[0];
const id = (/#[\w-]+/.exec(selector) || []).map(removeFirstChar)[0];
const classes = /(\.[\w-]+)/g.getAllMatches(selector).map(removeFirstChar);

Expand Down Expand Up @@ -98,7 +98,7 @@ class SelectorSolver {

// make sure the text before the cursor is a valid selector
// only preceded by spaces
const match = /^\s*([\w.#-_]*)$/.exec(textBeforeCursor);
const match = /^\s*([\w.#-_:]*)$/.exec(textBeforeCursor);

if (!match || match.length < 1) {
return;
Expand Down
4 changes: 4 additions & 0 deletions spec/selector-solver-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,9 @@ describe("selector-to-tab", function () {

expect(editor.getText()).toBe('<input type="button" name="name" value="">');
});

it("should solve tags with a namespace prefix", function () {
testSelector("ns:View", '<ns:View></ns:View>');
});
});
});

0 comments on commit 2c773f6

Please sign in to comment.