Permalink
Browse files

Update browserified version

  • Loading branch information...
1 parent fb8706a commit 5731ab91bbc3c8061ffa8904e5a227e9841c499e @ixti ixti committed Dec 3, 2012
Showing with 59 additions and 3 deletions.
  1. +28 −0 demo/js/js-yaml.js
  2. +28 −0 js-yaml.js
  3. +3 −3 js-yaml.min.js
View
@@ -20,6 +20,34 @@
* THE SOFTWARE.
*/
+(function () {
+ 'use strict';
+
+ // getOwnPropertyNames shim for IE7. Thanks to @Fanjita
+ // Not using es5-shams as they give more problems. See:
+ // https://github.com/nodeca/js-yaml/issues/49#issuecomment-10963606
+ if ('function' !== typeof Object.getOwnPropertyNames) {
+ Object.getOwnPropertyNames = function getOwnPropertyNames(obj) {
+ var keys = [], k;
+
+ // Only iterate the keys if we were given an object, and
+ // a special check for null, as typeof null == "object"
+ if (!!obj && 'object' === typeof obj) {
+ // Use a standard for in loop
+ for (k in obj) {
+ // A for in will iterate over members on the prototype
+ // chain as well, but Object.getOwnPropertyNames returns
+ // only those directly on the object, so use hasOwnProperty.
+ if (obj.hasOwnProperty(k)) {
+ keys.push(k);
+ }
+ }
+ }
+
+ return keys;
+ };
+ }
+}());
var jsyaml = window.jsyaml = (function () {
var require = function (file, cwd) {
var resolved = require.resolve(file, cwd || '/');
View
@@ -20,6 +20,34 @@
* THE SOFTWARE.
*/
+(function () {
+ 'use strict';
+
+ // getOwnPropertyNames shim for IE7. Thanks to @Fanjita
+ // Not using es5-shams as they give more problems. See:
+ // https://github.com/nodeca/js-yaml/issues/49#issuecomment-10963606
+ if ('function' !== typeof Object.getOwnPropertyNames) {
+ Object.getOwnPropertyNames = function getOwnPropertyNames(obj) {
+ var keys = [], k;
+
+ // Only iterate the keys if we were given an object, and
+ // a special check for null, as typeof null == "object"
+ if (!!obj && 'object' === typeof obj) {
+ // Use a standard for in loop
+ for (k in obj) {
+ // A for in will iterate over members on the prototype
+ // chain as well, but Object.getOwnPropertyNames returns
+ // only those directly on the object, so use hasOwnProperty.
+ if (obj.hasOwnProperty(k)) {
+ keys.push(k);
+ }
+ }
+ }
+
+ return keys;
+ };
+ }
+}());
var jsyaml = window.jsyaml = (function () {
var require = function (file, cwd) {
var resolved = require.resolve(file, cwd || '/');
Oops, something went wrong.

0 comments on commit 5731ab9

Please sign in to comment.