Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patch to make lib work in IE7/8 #37

Closed
wants to merge 1 commit into from
Closed

Conversation

somebox
Copy link
Contributor

@somebox somebox commented Nov 18, 2011

Just sharing a patch... markdown.js was failing in IE7/8 on a project I've been working on. I had to quickly make some patches for IE7/8 users because a js error was being thrown: http://dl.dropbox.com/u/385855/Screenshots/8k3z.png

Please note that the following tests are not passing (mostly edge cases). I've not yet had the time to fix but I could try. Please let me know if you have any suggestions as to how I could refactor to get everything green again?

https://gist.github.com/5cddc20d3bb395698a84

Thanks for the great library!

@alexwhitman
Copy link

+1 for this.

}
var isArray = Array.isArray || function(obj) {
return Object.prototype.toString.call(obj) == '[object Array]';
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only part of this patch that looks fishy. What part of this wasn't unchanged in IE8?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not quite sure. I seem to remember isArray was problematic in IE, so I looked to userscore.js to see how they did it.

@ashb
Copy link
Collaborator

ashb commented Apr 9, 2012

Pushed in 69c5107. Had to change a few things to get test passing. Turns out my [^] in regex was a short hand to say match anything including new lines. Dirty hack on my part - [\s\S] is the slightly clearer version.

The forEach replacement needed index and the array iterating over passed in too, which I've pulled out into a helper method in c360714

@ashb ashb closed this Apr 9, 2012
@Jinjiang
Copy link

line: 563 var found = stack.some(function(s, i) { also has problem in IE 7/8. method some is not supported

@ashb
Copy link
Collaborator

ashb commented Apr 13, 2012

Thanks - fixed the one too. Should really test this in IE's myself at some point :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants