digitalbazaar/jsonld.js — pull request #32 by jmandel (2013-06-21 00:33:41+00:00)
Title: IE8 compatibility fixes

Something like the following is needed to make jsonld.js run in IE8 (which, unfortunately, is still a reality in some environments).

1. Outside of JSLD, assume that polyfills have been defined for `Array.forEach`, `Array.isArray`, `Object.keys`, etc.
2. Inside JSLD, don't assume it's save to iterate through arrays with "var i in arrayName" (because this will pick up properties from the polyfill library)
3. Inside JSLD, test more aggressively for `Object.definePropery` (because in IE8, this *exists* but doesn't **work** for non-DOM nodes)

This pull request addresses #2 and #3; #1 is out of scope.

I wasn't totally clear in every instance which loops were over arrays vs. objects (and some were explicitly "agnostic"). Perhaps the best I can say is this PR doesn't break any tests that were passing in master :-)