fix(ivy): support web worker nodes in unknown property checks (#28610)

We need to support rendering in contexts like web workers where
nodes are emulated and properties may not be set directly. This
commit gates property validation checks to environments that have
real Node objects.

FW-1043 #resolve

PR Close #28610
This commit is contained in:
Kara Erickson 2019-02-07 16:41:24 -08:00 committed by Miško Hevery
parent f7591f1302
commit fb9a4a668c
2 changed files with 2 additions and 1 deletions

View File

@ -4,5 +4,4 @@ example_test(
name = "todo", name = "todo",
srcs = glob(["**/*.ts"]), srcs = glob(["**/*.ts"]),
server = "//modules/playground/src/web_workers/todo:devserver", server = "//modules/playground/src/web_workers/todo:devserver",
tags = ["fixme-ivy-aot"],
) )

View File

@ -1217,6 +1217,8 @@ function validateAgainstUnknownProperties(
element: RElement | RComment, propName: string, tNode: TNode) { element: RElement | RComment, propName: string, tNode: TNode) {
// If prop is not a known property of the HTML element... // If prop is not a known property of the HTML element...
if (!(propName in element) && if (!(propName in element) &&
// and we are in a browser context... (web worker nodes should be skipped)
typeof Node === 'function' && element instanceof Node &&
// and isn't a synthetic animation property... // and isn't a synthetic animation property...
propName[0] !== ANIMATION_PROP_PREFIX) { propName[0] !== ANIMATION_PROP_PREFIX) {
// ... it is probably a user error and we should throw. // ... it is probably a user error and we should throw.