public
Created

Sizzle quoted selector bisect -> af8206ff677909e61aec0158443ff74263e6265b

  • Download Gist
bisect.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13
#!/usr/bin/env phantomjs
var page = require('webpage').create();
page.open("file:///Users/wpalmer/git/sizzle/t.html", function(status){
try {
phantom.exit(
page.evaluate(function(){
return window.Sizzle('p:eq("3")');
}).length !== 0
)
} catch(e) {
phantom.exit(0);
}
});
bisect.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#!/bin/bash
# 831c9c489ef90134436449b5c732f93f0a0b29bb can use quotes in :eq(...)
# 4674e7ed7f0f19bcbaaf7710ba256db374c0dd9b [random point in the past] cannot use quotes in :eq(...)
# Trying to find first commit in which quotes can be used in :eq(...)
 
git bisect start 831c9c489ef90134436449b5c732f93f0a0b29bb 4674e7ed7f0f19bcbaaf7710ba256db374c0dd9b
git bisect run "$(dirname "$0")/bisect.js"
 
# the result was af8206ff677909e61aec0158443ff74263e6265b
# however, the parent of af8206ff677909e61aec0158443ff74263e6265b does not fail silently
# At what point did we go from "silently failing" to "explicitly not working" prior to "working"?
 
git bisect reset
git bisect start af8206ff677909e61aec0158443ff74263e6265b^ 4674e7ed7f0f19bcbaaf7710ba256db374c0dd9b
git bisect run "$(dirname "$0")/bisect2.js"
 
# the result was e89d06c4134ec439e52382acd0e569e97fed7ebc
bisect2.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
 
#!/usr/bin/env phantomjs
var page = require('webpage').create();
page.open("file:///Users/wpalmer/git/sizzle/t.html", function(status){
try {
var match = page.evaluate(function(){
try {
return window.Sizzle('p:eq("3")');
} catch(e) {
return "EX";
}
});
 
if( match === "EX" ){
phantom.exit(1); // explicitly not parsed
} else {
phantom.exit(0); // fails silently
}
} catch(e) {
phantom.exit(125); //error
}
});
t.html
HTML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
<html>
<head>
<script src="sizzle.js"></script>
<title>Title</title>
</head>
<body>
<div id="a">
<h1>Header a</h1>
<p>
First Paragraph
</p>
<p>
Second Paragraph
</p>
</div>
<div id="b">
<h1>Header b</h1>
<p>
Third Paragraph
</p>
<p>
Fourth Paragraph
</p>
</div>
</body>
</html>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.