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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions lib/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,9 @@ Markdown.dialects.Gruber = {
// Deal with code blocks or properly nested lists
if (contained.length > 0) {
// Make sure all listitems up the stack are paragraphs
stack.forEach( paragraphify, this );
for (var i = 0, l = stack.length; i < l; i++) {
paragraphify.call(this, stack[i]);
}

last_li.push.apply( last_li, this.toTree( contained, [] ) );
}
Expand All @@ -630,7 +632,9 @@ Markdown.dialects.Gruber = {
}

// Make sure all listitems up the stack are paragraphs
stack.forEach( paragraphify , this );
for (var i = 0, l = stack.length; i < l; i++) {
paragraphify.call(this, stack[i]);
}

loose = true;
continue loose_search;
Expand Down Expand Up @@ -764,7 +768,9 @@ Markdown.dialects.Gruber.inline = {
re.lastIndex += ( len - m[2].length );

// Add children
res.forEach(add);
for (var i = 0, l = res.length; i < l; i++) {
add(res[i]);
}

lastIndex = re.lastIndex;
}
Expand Down Expand Up @@ -1090,7 +1096,7 @@ Markdown.dialects.Maruku.block.block_meta = function block_meta( block, next ) {

Markdown.dialects.Maruku.block.definition_list = function definition_list( block, next ) {
// one or more terms followed by one or more definitions, in a single block
var tight = /^((?:[^\s:].*\n)+):\s+([^]+)$/,
var tight = /^((?:[^\s:].*\n)+):\s+([\^]+)$/,
list = [ "dl" ];

// see if we're dealing with a tight or loose block
Expand Down Expand Up @@ -1165,9 +1171,9 @@ Markdown.dialects.Maruku.inline[ "{:" ] = function inline_meta( text, matches, o
Markdown.buildBlockOrder ( Markdown.dialects.Maruku.block );
Markdown.buildInlinePatterns( Markdown.dialects.Maruku.inline );

var isArray = expose.isArray = function(obj) {
return (obj instanceof Array || typeof obj === "array" || Array.isArray(obj));
}
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.


function extract_attr( jsonml ) {
return isArray(jsonml)
Expand Down