-
-
Notifications
You must be signed in to change notification settings - Fork 236
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
Provide DOM-element source code location information #30
Comments
Hi. This makes sense. If you wouldn't mind I'll rename issue, since I would like to implement it for both tree adapters, so it requires more generic title. |
Great! 😄 |
@inikulin I'm very interested too with this feature, because I would like to use SimpleApiParser to retrieve attributes id of an HTML DOM with location. Indeed, I would like to write a tern plugin http://ternjs.net/doc/demo.html to provide completion, navigation for attributes id for
<html>
<script src="test.js" />
<div id="MyId" ></div>
</html>
var elt = document.getElementById(' // Here Ctrl+Space shows MyId To manage this case, I will load test.html with parse5 to retrieve attributes id. I need location to support navigation to the HTML file : var elt = document.getElementById('MyId' // Here Ctrl+click on MyId open the test.html and select MyId. So I need location for this case. Hope you will have time to support this issue. Thanks! |
Hi, guys. |
Cool!
In my case, I need start/end index for attribute value : <div id="MyId" >
| |
start end So the token could have this structure : {
"type": "START_TAG_TOKEN",
"tagName": "div",
"selfClosing": false,
"attrs": [
{
"name": {
"content": "id",
"start": 5,
"end": 7
},
"value": {
"content": "MyId",
"start": 9,
"end": 13
}
}
],
"start": 0,
"end": 16
} |
I only need the start index for my use case. And I don't need any attribute-level info. |
@cvrebert Is it important for you to have the same property naming ( |
I don't care what you name it, so long as it doesn't overlap with any existing browser DOM property. |
Good, thank you. |
Line/column position for start/end would be awesome as well. |
In my case I need position and not line/column. So I think it should be cool if we could customize that with a boolean option |
New version 1.4.0 with this functionality was published to the npm (see changelog). @angelozerr I haven't implemented location info for the attributes in this release, since it's a quite tricky thing to do and I don't have a good idea how to implement it at the moment, so I've created separate issue for this functionality (#43). |
Thanks for this info. I will wait for this features in a future release, if you can implement it. |
Parse errors for a bunch of insertion modes with a word "head" in them
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.5.3 to 4.5.4. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](microsoft/TypeScript@v4.5.3...v4.5.4) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
It would be great if parse5 supported the
startIndex
property of htmlparser2's DOM.See https://github.com/fb55/domhandler#option-withstartindices for a description.
It's very useful for e.g. lint tools that want to point out the source code locations of DOM elements.
The text was updated successfully, but these errors were encountered: