Parsing fails and there is raw html code in rendered html
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
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- html, typescript
- Lĩnh vực
- web-dev
Hướng nghiên cứu
Tái hiện vấn đề bằng bài viết được liên kết và ví dụ DOMParser, sau đó kiểm tra Tokenizer.ts xung quanh quá trình chuyển trạng thái isSpecial. So sánh hành vi hiện tại với htmlparser2 v6.1.0 và xác minh rằng kết quả được render không còn hiển thị HTML raw đã escape, đồng thời vẫn duy trì hiệu năng của parser và cách xử lý các thẻ đặc biệt khác.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hi there,
Parsing fails for some pages ( eg. this article )
To replicate, open the generated html in a browser
const document = (new DOMParser).parseFromString(htmlFromTheArticle, 'text/html');
const html = document.body.innerHTML;
Instead of the original page, it now includes raw html code.
Διαβάστε το πλήρες κείμενο του σημειώματος του CEO της UBS στο <a href="https://www.newmoney.gr/roh/bloomberg/to-esoteriko-simioma-tou-ceo-tis-ubs-pros-tous-ergazomenous-meta-tin-exagora-tis-credit-suisse/" target="_blank" rel="noopener noreferrer">newmoney.gr</a><br> <br> <strong><a href="https://www.protothema.gr/oles-oi-eidiseis/" target="_blank" rel="noopener noreferrer">Ειδήσεις σήμερα:</a><br> <br> <a href="https://www.protothema.gr/greece/article/1351532/xanthi-ston-eisaggelea-simera-o-36hronos-pou-skotose-ton-45hrono-epeidi-ton-theorise-roufiano/" target="_blank" rel="noopener noreferrer">...
It happened for many html documents already. The culprit is htmlparser2, if I downgrade to v6.1.0, it works properly.
I tried to debug and the problem is caused in Tokenizer.ts. When I simply replace these lines
if (this.isSpecial) {
this.state = State.InSpecialTag;
this.sequenceIndex = 0;
} else {
this.state = State.Text;
}
With
this.state = State.Text;
It works properly. I'm not sure what is the proper fix, which will not affect the performance of htmlparser2, so I opened this issue instead.
- Ngôn ngữ chính
- HTML
- Star
- 2.1k
- Fork
- 104
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của WebReflection/linkedom
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
WebReflection/linkedom#329 · 5 bình luận ·
-
`el.style.property = ''` and `e.style.setProperty('property', '')` should delete the property Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
WebReflection/linkedom#327 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
WebReflection/linkedom#326 · 5 bình luận ·
-
Build Apps For AI Agent. Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
WebReflection/linkedom#321 · 1 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
WebReflection/linkedom#318 · 5 bình luận ·
Tất cả issue của WebReflection/linkedom
Issue tương tự
-
refactor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
Issue-Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
sugarlabs/musicblocks#8924 ·
-
dragonball.fandom.com Đang mởN: AdGuard Browser Extension P2: High T: Annoyance
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
AdguardTeam/AdguardFilters#242499 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
paperclipai/paperclip#13957 ·
-
[Bug]: Console does not validate "Confirm new password" when a user changes their own password Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100