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

error when rendering with $!{} in .marko file #1943

Closed
xd-dw opened this issue Apr 24, 2023 · 3 comments
Closed

error when rendering with $!{} in .marko file #1943

xd-dw opened this issue Apr 24, 2023 · 3 comments
Labels
type:unverified bug A bug report that has not been verified

Comments

@xd-dw
Copy link

xd-dw commented Apr 24, 2023

Marko Version: x.x.x

"marko": "^5.25.1"

Details

i try to render below text with $!{} in .marko file

"……CrudRepository ——通用CRUD操作的接口。……删除多个对象 这是调用 CrudRepository<T, ID extends Serializable> 接口的 void delete(Iterable<?……统计对象数量 这是调用 CrudRepository<T, ID extends Serializable> 接口的 long count() 方法来统计对象数量。……"

but i get below error:

Screenshot 2023-04-24 at 16 02 19

i tried jQuery.parseHTML(), it seems good, not sure why marko report above error.

Expected Behavior

No error when rendering with $!{}

Actual Behavior

error happened

Possible Fix

Additional Info

Your Environment

  • Environment name and version (e.g. Chrome 39, node.js 5.4): Microsoft Edge Version 111.0.1661.62 (Official build) (x86_64)
  • Operating System and version (desktop or mobile): MacBook Air Retina, 13-inch, 2018, MacOS 13.3 (22E252)
  • Link to your project:

Steps to Reproduce

  1. first...

Stack Trace

Compiled with problems:
ERROR
Cannot set properties of undefined (setting '___parentNode')
TypeError: Cannot set properties of undefined (setting '___parentNode')
at VElement.___appendChild (http://localhost:8080/static/vendors-node_modules_ebay_ebayui-core_dist_components_ebay-icon-button_index_marko-node_modul-4e85aa.a9642353.js:6884:27)
at virtualizeChildNodes (http://localhost:8080/static/vendors-node_modules_ebay_ebayui-core_dist_components_ebay-icon-button_index_marko-node_modul-4e85aa.a9642353.js:8234:16)
at Function.virtualizeElement [as ___virtualize] (http://localhost:8080/static/vendors-node_modules_ebay_ebayui-core_dist_components_ebay-icon-button_index_marko-node_modul-4e85aa.a9642353.js:6657:5)
at virtualize (http://localhost:8080/static/vendors-node_modules_ebay_ebayui-core_dist_components_ebay-icon-button_index_marko-node_modul-4e85aa.a9642353.js:8242:23)
at virtualizeHTML (http://localhost:8080/static/vendors-node_modules_ebay_ebayui-core_dist_components_ebay-icon-button_index_marko-node_modul-4e85aa.a9642353.js:8261:33)
at AsyncVDOMBuilder.html (http://localhost:8080/static/vendors-node_modules_ebay_ebayui-core_dist_components_ebay-icon-button_index_marko-node_modul-4e85aa.a9642353.js:5978:22)
at marko_template..marko_src_runtime_components_renderer_js__WEBPACK_IMPORTED_MODULE_2___default.t (http://localhost:8080/static/home_tTbh.c7c6f788.js:836:21)
at renderer (http://localhost:8080/static/vendors-node_modules_ebay_ebayui-core_dist_components_ebay-icon-button_index_marko-node_modul-4e85aa.a9642353.js:4829:5)
at proxyRenderer (http://localhost:8080/static/vendors-node_modules_ebay_ebayui-core_dist_components_ebay-icon-button_index_marko-node_modul-4e85aa.a9642353.js:7094:21)
at renderTagHelper (http://localhost:8080/static/vendors-node_modules_ebay_ebayui-core_dist_components_ebay-icon-button_index_marko-node_modul-4e85aa.a9642353.js:5571:77)

@xd-dw xd-dw added the type:unverified bug A bug report that has not been verified label Apr 24, 2023
@DylanPiercey
Copy link
Contributor

You will see this error when invalid html, or html which does not produce a consistent structure when hydrating (eg something that relies on automatic tag insertion) is used.

@xd-dw
Copy link
Author

xd-dw commented Apr 26, 2023

i guess it was caused by such tags in the text which are not standard html tags:

  1. <T, ID extends Serializable>
  2. <?……统计对象数量

can Marko just ignore unknown tags when rendering using $!{} ?

@DylanPiercey
Copy link
Contributor

@xd-dw the $!{} passes through the html as is, however it does have to be well formatted in order for Marko to hydrate it and operate properly. If you want to sanitize the html before providing it to Marko you'll have to bring in a library which does so. There's also the native Sanitizer API but it has limited browser support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:unverified bug A bug report that has not been verified
Projects
None yet
Development

No branches or pull requests

2 participants