→ Lyndon
26 August 2009
Yesterday Ilya Grigorik wrote:
“I’m still secretly hoping that one day our curl command client will just have a flag to return the final post-Javascript DOM.”
You don’t have to hope and it doesn’t have to be a secret, Ilya. Lyndon is most of the way there.
Tonight I committed a change that lets us pipe this into Lyndon:
<!DOCTYPE html>
<html>
<head>
<title>Lyndon Test!</title>
<script type="text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
</script>
<script>
$(function() {
$('#content').append('<div id="hi">Hello world!</div>')
$('script').remove()
document.title = 'It worked!'
})
</script>
</head>
<body>
<div id="content">
</div>
</body>
</html>
to get this:
<html>
<head>
<title>It worked!</title>
</head>
<body>
<div id="content">
<div id="hi">Hello world!</div>
</div>
</body>
</html>
We added the Hello world! bit, changed the <title>, and removed the script tags dynamically. On the command line. With MacRuby.
Joyous.
Lyndon can even do a lot of the stuff Johnson can do. Check the README for the full scoop.