Update to latest jsonld.js.
authorDave Longley <dlongley@digitalbazaar.com>
Sat, 21 Apr 2012 15:38:53 -0400
changeset 561 2e5a95a341d4
parent 560 3a78d3cda32f
child 562 ab64343c078a
Update to latest jsonld.js.
playground/jsonld.js
--- a/playground/jsonld.js	Sat Apr 21 12:31:56 2012 -0700
+++ b/playground/jsonld.js	Sat Apr 21 15:38:53 2012 -0400
@@ -2124,7 +2124,10 @@
 
       // iterate over subject properties
       var subject = matches[id];
-      for(var prop in subject) {
+      var props = Object.keys(subject).sort();
+      for(var i in props) {
+        var prop = props[i];
+
         // copy keywords to output
         if(_isKeyword(prop)) {
           output[prop] = _clone(subject[prop]);
@@ -2183,7 +2186,10 @@
       }
 
       // handle defaults
-      for(var prop in frame) {
+      var props = Object.keys(frame).sort();
+      for(var i in props) {
+        var prop = props[i];
+
         // skip keywords
         if(_isKeyword(prop)) {
           continue;
@@ -2246,8 +2252,11 @@
  * @return all of the matched subjects.
  */
 function _filterSubjects(state, subjects, frame) {
+  // filter subjects in @id order
   var rval = {};
-  for(var id in subjects) {
+  var ids = Object.keys(subjects).sort();
+  for(var i in ids) {
+    var id = ids[i];
     var subject = state.subjects[id];
     if(_filterSubject(subject, frame)) {
       rval[id] = subject;