Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Value of a foreign input element is an attribue

Đang mở
#268 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
javascript
Lĩnh vực
web-dev

Hướng nghiên cứu

Bắt đầu bằng cách chạy hai bản tái hiện DOMParser từ issue, so sánh các đường dẫn phân tích HTML và image/svg+xml đối với đầu vào có foreignObject. Theo dõi cách đầu vào đã được phân tích cú pháp hiển thị thuộc tính value của nó so với attribute value của nó. Công việc được hoàn tất khi trường hợp SVG trả về giá trị ban đầu thông qua my_input.value, khớp với hành vi của trình duyệt, cùng với phạm vi kiểm thử hồi quy cho bản tái hiện.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement

Dear,

First of all thank for sharing this nice library!

I have an issue when using an html input element as foreign object inside an svg drawing. Not sure if there is anything wrong with this library, or just me doing something not correctly...

BTW if you are wondering why such foreign objects are used, you can here see a demo animation on my wiki to see how it can be used for example for floorplans in home automation.

Case 1: input elements (ok)

I set a default value "Initial" to an input element:

let html = '<html><head></head><body><input id="my_input" value="initial"></body></html>'
let parser = new DOMParser()
let doc = parser.parseFromString(html, 'text/html')
let my_input = doc.querySelector('#my_input')
let value = my_input.value

Both in a browser and using Linkedom the element.value contains that default value:

image

Case 2: input elements as foreign object in svg (nok)

I set a default value "Initial" to an input element, which is a foreign object inside an svg drawing:

let html = '<svg xmlns="http://www.w3.org/2000/svg"><foreignObject><input id="my_input" value="initial" xmlns="http://www.w3.org/1999/xhtml"></foreignObject></svg>'
let parser = new DOMParser()
let doc = parser.parseFromString(html, 'image/svg+xml')
let my_input = doc.querySelector('#my_input')
let value = my_input.value

When running this in a browser, the element.value still contains that default value (as expected):

image

However when running this code in Linkedom, the element.value is undefined. And instead the "initial" is stored inside an attribute with name "value":

image

Hopefully somebody sees what I am doing wrong.

Thanks!!
Bart

Ngôn ngữ chính
HTML
Star
2.1k
Fork
108
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của WebReflection/linkedom

Tất cả issue của WebReflection/linkedom

Issue tương tự

Thêm issue về Web Dev

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.