Skip to content

Commit

Permalink
Pass relaxed property to children, siblings, allElements and parents …
Browse files Browse the repository at this point in the history
…of an element
  • Loading branch information
danisty authored and christian-draeger committed Nov 29, 2023
1 parent 7f81330 commit 8e1d6de
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions html-parser/src/main/kotlin/it/skrape/selects/DocElement.kt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public class DocElement internal constructor(
* Get this element's parent and ancestors, up to the document root.
* @return List<DocElement> of parents, closest first.
*/
public val parents: List<DocElement> by lazy { element.parents().map { DocElement(it) } }
public val parents: List<DocElement> by lazy { element.parents().map { DocElement(it, this.relaxed) } }

/**
* Get this element's parent and ancestors, up to the document root as lambda.
Expand Down Expand Up @@ -132,7 +132,7 @@ public class DocElement internal constructor(
* Get all elements that are siblings of this element.
* @return List<DocElement> of all siblings.
*/
public val siblings: List<DocElement> by lazy { element.siblingElements().map { DocElement(it) } }
public val siblings: List<DocElement> by lazy { element.siblingElements().map { DocElement(it, this.relaxed) } }

/**
* Get all elements that are siblings of this element as lambda.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ public abstract class DomTreeElement : CssSelectable() {
* Find all elements in the document.
* @return List<DocElement>
*/
public val allElements: List<DocElement> by lazy { element.allElements.map { DocElement(it) } }
public val allElements: List<DocElement> by lazy { element.allElements.map { DocElement(it, this.relaxed) } }

/**
* Get this element's child elements.
* @return List<DocElement> of child elements. If this element has no children, returns an empty list.
*/
public val children: List<DocElement> by lazy {
element.children().map { DocElement(it) }
element.children().map { DocElement(it, this.relaxed) }
}

/**
Expand Down

0 comments on commit 8e1d6de

Please sign in to comment.