@@ -240,7 +240,7 @@ JSValueRef JSNode::appendChild(JSContextRef ctx, JSObjectRef function, JSObjectR
240
240
JSObjectRef nodeObjectRef = JSValueToObject (ctx, nodeValueRef, exception );
241
241
auto nodeInstance = static_cast <NodeInstance *>(JSObjectGetPrivate (nodeObjectRef));
242
242
243
- if (nodeInstance == nullptr || nodeInstance->_identify != NODE_IDENTIFY ) {
243
+ if (nodeInstance == nullptr || nodeInstance->document != selfInstance-> document ) {
244
244
throwJSError (ctx, " Failed to execute 'appendChild' on 'Node': first arguments should be an Node type." , exception );
245
245
return nullptr ;
246
246
}
@@ -288,7 +288,7 @@ JSValueRef JSNode::insertBefore(JSContextRef ctx, JSObjectRef function, JSObject
288
288
auto selfInstance = static_cast <NodeInstance *>(JSObjectGetPrivate (thisObject));
289
289
auto nodeInstance = static_cast <NodeInstance *>(JSObjectGetPrivate (nodeObjectRef));
290
290
291
- if (nodeInstance == nullptr || nodeInstance->_identify != NODE_IDENTIFY ) {
291
+ if (nodeInstance == nullptr || nodeInstance->document != selfInstance-> document ) {
292
292
throwJSError (ctx, " Failed to execute 'insertBefore' on 'Node': parameter 1 is not of type 'Node'" , exception );
293
293
return nullptr ;
294
294
}
@@ -331,14 +331,14 @@ JSValueRef JSNode::replaceChild(JSContextRef ctx, JSObjectRef function, JSObject
331
331
auto oldChildInstance = static_cast <NodeInstance *>(JSObjectGetPrivate (oldChildObjectRef));
332
332
333
333
if (oldChildInstance == nullptr || oldChildInstance->parentNode != selfInstance ||
334
- oldChildInstance->_identify != NODE_IDENTIFY ) {
334
+ oldChildInstance->document != selfInstance-> document ) {
335
335
throwJSError (ctx,
336
336
" Failed to execute 'replaceChild' on 'Node': The node to be replaced is not a child of this node." ,
337
337
exception );
338
338
return nullptr ;
339
339
}
340
340
341
- if (newChildInstance == nullptr || newChildInstance->_identify != NODE_IDENTIFY ) {
341
+ if (newChildInstance == nullptr || newChildInstance->document != selfInstance-> document ) {
342
342
throwJSError (ctx, " Failed to execute 'replaceChild' on 'Node': The new node is not a type of node." , exception );
343
343
return nullptr ;
344
344
}
@@ -424,7 +424,7 @@ JSValueRef JSNode::removeChild(JSContextRef ctx, JSObjectRef function, JSObjectR
424
424
auto selfInstance = static_cast <NodeInstance *>(JSObjectGetPrivate (thisObject));
425
425
auto nodeInstance = static_cast <NodeInstance *>(JSObjectGetPrivate (nodeObjectRef));
426
426
427
- if (nodeInstance == nullptr || nodeInstance->_identify != NODE_IDENTIFY ) {
427
+ if (nodeInstance == nullptr || nodeInstance->document != selfInstance-> document ) {
428
428
throwJSError (ctx, " Failed to execute 'removeChild' on 'Node': 1st arguments is not a Node object." , exception );
429
429
return nullptr ;
430
430
}
0 commit comments