Skip to content

Commit

Permalink
Fix README
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhodgins committed Sep 10, 2017
1 parent 74c40c5 commit 73d1a9b
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions README.md
Expand Up @@ -401,42 +401,6 @@ ancestor('#start', '.target', `border-color: lime`)
}
```


## code

```javascript
function ancestor(selector, ancestor, rule) {

var tag = document.querySelectorAll(ancestor)
var style = ''
var count = 0

for (var i=0; i<tag.length; i++) {

var descendant = tag[i].querySelector(selector)

if (descendant) {

var attr = (selector+ancestor).replace(/\W+/g, '')

tag[i].setAttribute('data-ancestor-' + attr, count)

style += '\n/* ' + selector + ':ancestor(' + ancestor + ') */\n'
+ '[data-ancestor-' + attr + '="' + count + '"] {\n'
+ ' ' + rule + '\n'
+ '}\n'

count ++

}

}

return style

}
```

## demo

- [Ancestor Selector Mixin Demo](https://tomhodgins.github.io/reprocss/test/ancestor-selector-mixin.html)
Expand Down

0 comments on commit 73d1a9b

Please sign in to comment.