Closed vladvlasov256 closed 6 years ago
Impossible to change an attribute of a cloned element if its original element had attributes.
An example:
HTMLElement *element = [HTMLElement new]; element.elementId = @"originalId"; HTMLElement *clone = [element cloneNodeDeep:YES]; NSString *cloneId = @"cloneId"; clone.elementId = cloneId
The last line raises the NSInvalidArgumentException: _[_NSSingleEntryDictionaryI setObject:forKeyedSubscript:]: unrecognized selector sent to instance 0x7fcbd143e150
The root cause is the HTMLElement copy method:
- (id)copyWithZone:(NSZone *)zone { ... copy->_attributes = [_attributes copy]; ... }
If the _attributes is not nil a copy will be a NSDictionary not a HTMLOrderedDictionary.
@CRivlaldo Hey, great catch! Thanks for reporting!
Impossible to change an attribute of a cloned element if its original element had attributes.
An example:
The last line raises the NSInvalidArgumentException: _[_NSSingleEntryDictionaryI setObject:forKeyedSubscript:]: unrecognized selector sent to instance 0x7fcbd143e150
The root cause is the HTMLElement copy method:
If the _attributes is not nil a copy will be a NSDictionary not a HTMLOrderedDictionary.