1
1
mirror of https://github.com/github/semantic.git synced 2024-11-25 11:04:00 +03:00

Diffs are model objects.

This commit is contained in:
Rob Rix 2015-10-21 16:24:56 -04:00
parent 6a515d917d
commit 87862e839b

View File

@ -120,9 +120,10 @@
return new Leaf(json, a, b);
}
function diff(json, a, b) {
if (json.pure != null) { return patch(json.pure, a, b); }
if (json.roll != null) { return syntax(json.roll, a, b, diff); }
function Diff(json, a, b) {
if (json.pure != null) { this.pure = patch(json.pure, a, b); }
if (json.roll != null) { this.roll = syntax(json.roll, a, b, diff); }
return this;
}
</script>
</head>
@ -131,7 +132,7 @@
<script type="text/javascript">
loadJSON('diff.json', function (json) {
console.log(json.diff);
var model = diff(json.diff, json.a, json.b);
var model = new Diff(json.diff, json.a, json.b);
var dom = toDOM(model);
var root = document.getElementById("diff");
root.appendChild(dom);