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

(#35) Fix errors in IE 8 and older #36

Merged
merged 2 commits into from
Sep 3, 2013
Merged
Show file tree
Hide file tree
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
5 changes: 0 additions & 5 deletions lib/command.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 13 additions & 23 deletions lib/md.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion src/md.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ class HtmlParser
url: @options.base
@win = doc.createWindow()

# Create the Node constants if Node doesn't exist (i.e. when running in IE < 9).
unless @win.Node?
@win.Node =
Copy link
Owner

Choose a reason for hiding this comment

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

Since we only really reference ELEMENT_NODE and TEXT_NODE elsewhere in the code, it would be better to get rid of the others.

Copy link
Author

Choose a reason for hiding this comment

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

Sounds good.

ELEMENT_NODE: 1
TEXT_NODE: 3

# Append `str` to the buffer string.
append: (str) ->
@buffer += @last if @last?
Expand Down Expand Up @@ -190,7 +196,7 @@ class HtmlParser
# Determine whether or not the specified element is visible based on its CSS style.
isVisible: (ele) ->
style = @attr ele, 'style', no
properties = style?.match R_HIDDEN_STYLES
properties = style?.match?(R_HIDDEN_STYLES)
visible = yes

# Test all relevant CSS properties for possible hiding behaviours.
Expand Down