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

explicitCharkey doesn't work for whitespace #463

Open
jcsahnwaldt opened this issue Jun 10, 2018 · 1 comment
Open

explicitCharkey doesn't work for whitespace #463

jcsahnwaldt opened this issue Jun 10, 2018 · 1 comment

Comments

@jcsahnwaldt
Copy link
Contributor

With explicitCharkey: false (default), parsing results are predictable:

  • <x>y</x> -> { x: 'y' }
  • <x></x> -> { x: '' }
  • <x> </x> -> { x: ' ' }
  • <x>\n</x> (newline) -> { x: '\n' }

With explicitCharkey: true, parsing results can be surprising:

  • <x>y</x> -> { x: { _: 'y' } } (ok)
  • <x></x> -> { x: '' } (bad, no _)
  • <x> </x> -> { x: ' ' } (bad, no _)
  • <x>\n</x> (newline) -> { x: '\n' } (bad, no _)

When users set explicitCharkey: true, they probably expect an _ property in all objects. Currently, they have to distinguish the case where an element contains only whitespace from other cases and use different code to access the text content.

@jcsahnwaldt
Copy link
Contributor Author

Very likely related to #466: "handling of whitespace content inconsistent"

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