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

Tags that are self-closing in HTML create unexpected results in XML #85

Open
acabal opened this issue May 25, 2021 · 0 comments
Open

Tags that are self-closing in HTML create unexpected results in XML #85

acabal opened this issue May 25, 2021 · 0 comments

Comments

@acabal
Copy link

acabal commented May 25, 2021

Consider this XML:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://www.idpf.org/2007/opf">
	<meta>Foobar</meta>
	<meta>Foo bar</meta>
</package>

Placing the cursor in the first <meta> element, then expanding the region, correctly selects Foobar, then <meta>Foobar</meta> as expected.

However, placing the cursor in the second <meta> element, then expanding the region, first selects Foo, then the entire document. The expected result is Foo, then Foo bar, then <meta>Foo bar</meta>.

I believe this is because ExpandRegion is treating this as HTML, in which <meta> is a self-closing tag; see expand_to_xml_node.py line 109. But it's not HTML, it's XML, and the rules are a little different.

Setting void_elements = [] solves this issue, but presumably creates undesired behavior when expanding in HTML and not XML.

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

No branches or pull requests

1 participant