Skip to content

Commit

Permalink
fix: support namespaced tag selectors
Browse files Browse the repository at this point in the history
closes #
  • Loading branch information
fczbkk committed May 21, 2016
1 parent 7f66e19 commit d214007
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build/css-selector-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
};

CssSelectorGenerator.prototype.getTagSelector = function(element) {
return element.tagName.toLowerCase();
return this.sanitizeItem(element.tagName.toLowerCase());
};

CssSelectorGenerator.prototype.sanitizeItem = function(item) {
Expand Down
2 changes: 1 addition & 1 deletion src/css-selector-generator.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class CssSelectorGenerator
result

getTagSelector: (element) ->
element.tagName.toLowerCase()
@sanitizeItem element.tagName.toLowerCase()

# escapes special characters in class and ID selectors
sanitizeItem: (item) ->
Expand Down
5 changes: 5 additions & 0 deletions test/src/css-selector-generator.spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ describe 'CSS Selector Generator', ->
elm = root.querySelector '#linkZero'
expect(x.getTagSelector elm).toBe 'a'

it 'should get tag selector for namespaced element', ->
root.innerHTML = '<aaa:bbb />'
selector = x.getTagSelector root.firstChild
expect(root.querySelector selector).toEqual root.firstChild

describe 'ID', ->

it 'should get ID selector for an element', ->
Expand Down

0 comments on commit d214007

Please sign in to comment.