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

Handle <constructor> tags in htmlmixed mode (fixes mozilla bug 1214663) #3596

Closed
wants to merge 1 commit into from

Conversation

bgrins
Copy link
Contributor

@bgrins bgrins commented Oct 14, 2015

This fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1214663. The HTML mixed syntax mode is breaking the editor when encountering a <constructor> tag, so instead of checking that tagInfo exists, we need to make sure it's actually an array before continuing into findMatchingMode.

You can see the problem if you update the modes index.html demo to include this tag:

<constructor>
  foobar
</constructor>

@@ -91,10 +91,11 @@
function html(stream, state) {
var tagName = state.htmlState.tagName;
var tagInfo = tagName && tags[tagName.toLowerCase()];
var isTagInfoArray = Object.prototype.toString.call(tagInfo) === "[object Array]";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also considered using Array.isArray, but IE8 doesn't support that. I took this from the polyfill at https://developer.mozilla.org/ro/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray.

@marijnh marijnh closed this in eedb58f Oct 14, 2015
@marijnh
Copy link
Member

marijnh commented Oct 14, 2015

Woops how shoddy. I've pushed an alternative patch that solves this by checking out whether the property exists in the object itself, rather than checking for an array. That seems more idiomatic and robust.

@bgrins
Copy link
Contributor Author

bgrins commented Oct 14, 2015

Alright, thanks. Looks good to me.

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.

None yet

2 participants