Skip to content

bug: Accessing an IonLabel's textContent through childNodes property gives empty Array #6393

@ErikOnBike

Description

@ErikOnBike

Prerequisites

Stencil Version

v4.36.1

Current Behavior

When executing the following code the childNodes property value is an empty Array. The __childNodes property value is a NodeList with a single item. The later is correct, the first not.

let label = document.createElement("ion-label");
label.textContent = "Hello world";
console.log(label.childNodes); // Empty Array
console.log(label.__childNodes); // NodeList with a Text Node

Expected Behavior

The childNodes property value should be the same as the __childNodes result: a NodeList with a single Text Node. The childNodes property value should never be an Array, but always a (live) NodeList for compatibility with the Node interface:
https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes

System Info

Steps to Reproduce

Go to URL: https://ionicframework.com/docs/usage/v8/label/basic/demo.html?ionic:mode=ios
Enter the following script in the dev console.

let label = document.createElement("ion-label");
label.textContent = "Hello world";
console.log(label.childNodes); // Empty Array
console.log(label.__childNodes); // NodeList with a Text Node

Code Reproduction URL

https://ionicframework.com/docs/usage/v8/label/basic/demo.html?ionic:mode=ios

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug: ValidatedThis PR or Issue is verified to be a bug within Stencil

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions