In what scenarios the docs about 'The name "class" must be quoted in the object...' are relevant?
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, jquery
- Lĩnh vực
- documentation
Hướng nghiên cứu
Xem lại trang tài liệu API jquery tại https://api.jquery.com/jquery/ và so sánh nhận định của trang về việc đặt "class" trong dấu ngoặc kép với ví dụ JavaScript được cung cấp và kết quả theo phiên bản trình duyệt. Kiểm tra xem hướng dẫn này còn chính xác đối với các phiên bản liên quan hay không, sau đó cập nhật tài liệu để nêu rõ các trường hợp áp dụng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
jQuery version: 3.4.1
Hi jQuery docs team!
While I was reformatting some code with an automated tool, I noticed that tool removes the quotes in this kind of code:
// Original code
var $p = $('<p>', {
"class": "b-info", // I am USING quotes for "class"
text: "Appended text"
});
// After passing the formatter
var $p = $('<p>', {
class: 'b-info', // Quotes are removed from "class"
text: "Appended text"
});
So, I went back to jQuery docs in https://api.jquery.com/jquery/ where it is said:
The name "class" must be quoted in the object since it is a JavaScript reserved word, and "className" cannot be used since it refers to the DOM property, not the attribute.
I was wondering if you have identified scenarios/versions where this is RELEVANT.
I did some tests using this minimal code, in:
- Google Chrome: OK
- Safari: OK
- Firefox: OK
- MS Edge: OK
- IE 11: OK
- IE 10 (Emulation): OK
- IE 9 (Emulation): OK
- IE 8 (Emulation): FAILS
- IE 7 (Emulation): FAILS
So, it seems, this code ONLY fails on IE 8 and older versions of that browser, is that correct?
Thanks in advance.
Best regards.
<!doctype html>
<html lang="en">
<body>
<h1>jQuery test</h1>
<p>"Appended text" will be appended. Check your console too!</p>
<script src="./js/jquery-3.4.1.min.js"></script>
<script>
(function($) {
var $p = $('<p>', {
class: 'b-info', // I am not using quotes for "class"
text: 'Appended text'
});
$('body').append($p);
})(jQuery);
</script>
</body>
</html>
- Ngôn ngữ chính
- HTML
- Star
- 324
- Fork
- 259
- Merge trung bình
- 1 ngày 30 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
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 jquery/api.jquery.com
-
Mention of ‘timestamp’ in documentation for ‘cache’ parameter of ‘ajax’ is misleadingCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
jquery/api.jquery.com#1241 · 2 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
jquery/api.jquery.com#1176 ·
-
The documentation of CSS methods should be further classifiedCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
jquery/api.jquery.com#1281 · 2 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
jquery/api.jquery.com#1271 · 2 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
jquery/api.jquery.com#1259 ·
Tất cả issue của jquery/api.jquery.com
Issue tương tự
-
5-minutes algorithm all-levels any-language beginner-friendly community documentation easy first-timers-only good first issue hacktoberfest help wanted learning no-code-needed open-source python students
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 88/100
Huerte/algo-solutions-python#253 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
size/s
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
sipyourdrink-ltd/bernstein#7179 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area/docs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
meshery/meshery#23375 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Synthetic
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 66/100
samtoth/agda-synthetic-categories#373 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent-system-test-1319336938-43312257375-1- Agent System assignment-policy flow 43312257375-1Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
tanaabased/big-test-bucket#19952 ·
Maintainer thường phản hồi trong vòng 1 ngày