Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

selects done after the script tag fail #5

Closed
wants to merge 1 commit into from

4 participants

@emkay

This might be in sax, but I thought I would point out that selects done after the script tag fail.

@Floby

I second this.

@dlmanning

yep. I love the elegance of this module's design, but this is definitely broken.

@substack
Owner

Fixed in 0.3.3.

@substack substack closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 1, 2012
  1. @emkay
This page is out of date. Refresh to see the latest.
Showing with 21 additions and 2 deletions.
  1. +6 −0 test/script.html
  2. +15 −2 test/script.js
View
6 test/script.html
@@ -11,5 +11,11 @@
<script type="text/javascript">console.log(i<j)</script>
</div>
<div class="a">!!!</div>
+ <div class="c">boop</div>
+ <ul>
+ <li>test</li>
+ <li>this</li>
+ <li>out</li>
+ </ul>
</body>
</html>
View
17 test/script.js
@@ -3,7 +3,7 @@ var trumpet = require('../');
var fs = require('fs');
test('script', function (t) {
- t.plan(2);
+ t.plan(6);
var tr = trumpet();
fs.createReadStream(__dirname + '/script.html').pipe(tr);
@@ -12,7 +12,20 @@ test('script', function (t) {
t.equal(node.attributes.type, 'text/javascript');
node.html(function (src) {
t.equal(src, 'console.log(i<j)');
- t.end();
+ });
+ });
+
+ tr.select('title', function (node) {
+ t.equal(node.name, 'title');
+ node.html(function (html) {
+ t.equal(html, 'beep');
+ });
+ });
+
+ tr.select('.c', function (node) {
+ t.equal(node.name, 'div');
+ node.html(function (html) {
+ t.equal(html, 'boop');
});
});
});
Something went wrong with that request. Please try again.