This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Description
While writing html, the attribute-hints filter doesn't work properly if the current tag is not closed and a different tag (not a comment) immediately after it.
For example, the attributes id and class won't appear in the hint list in the following situation:
<div |
<div id="foo" class="clazz"></div>
This test could be added to CodeHintUtils-test.js to capture this issue:
it("should not find attributes of other tags on an opened tag", function () {
var pos = {"ch": 0, "line": 0};
setContentAndUpdatePos(pos,
["<html>", "<body>"],
"<div ", "",
["<div id='foo' class='clazz'>", "</body>", "</html>"]);
var attrs = HTMLUtils.getTagAttributes(myEditor, pos);
expect(attrs).toEqual([]);
});
This is caused because CodeMirror is returning "<div" as an attribute token rather than as a tag one. If this is the expected behavior and not to be changed, then an easy fix could be to check for tag attributes starting with < to break the attributes search inside getTagAttributes.