gost-dom / gost-dom/browser

`Attr.Parent()`/`ParentElement()` return incorrect values

Open
#73 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
300
Forks
15
PR merge metrics
No merged PRs in 30d

Description

`Attr` nodes return the element they are placed in as parent, but in a browser; the two values are nil.

The implementation was created as an `Attr` cannot be moved to another element.

```
// Throws, if `data-foo` is an attribute on elem2
elem1.setAttributeNode(elem2.getAttributeNode("data-foo"))

// While this is allowed
attr = elem2.getAttributeNode("data-foo")
elem2.removeAttributeNode(attr)
elem1.setAttributeNode(attr)
```

It was assumed that the information on the attribute was stored as the parent; but that was incorrect.

Contributor guide

Open the contributing guide

Research direction

Start at Attr.Parent() and Attr.ParentElement() and compare their behavior with the browser semantics described in the issue. Done means both methods return nil for Attr nodes, including after an attribute is removed from one element and attached to another.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
web-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.