-
Notifications
You must be signed in to change notification settings - Fork 19
Release v1.47.0 #1834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release v1.47.0 #1834
Changes from 38 commits
ae4a32a
8aa48bc
183fd07
573af34
4c65878
fcd7033
f3637f6
6f8f7df
1dd16ab
4771d9e
79f4f9c
bf1952c
0e491be
faecdc9
b757770
fdf6db2
1f771dc
109bfeb
a9196c9
42e5f49
be59792
09ec082
6149777
930856e
3f47a69
b334071
495908b
0164425
1fe86b6
2c4d280
7235c55
0f5e9ae
2e5e557
e19e7af
ae89430
8681cd1
b7f0e59
6d566ff
bcffe72
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -24,6 +24,11 @@ export default { | |||||||||||||||||||||
| return true; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // Skip 1x1 tracking pixels (any src or base64) | ||||||||||||||||||||||
| if ( hasEmptyAlt && isTrackingPixel( node ) ) { | ||||||||||||||||||||||
| return true; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // Return false if alt is empty and none of the exceptions apply | ||||||||||||||||||||||
| return ! hasEmptyAlt; | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
|
|
@@ -84,6 +89,33 @@ function isInsideValidCaption( node ) { | |||||||||||||||||||||
| return false; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /** | ||||||||||||||||||||||
| * Check if image is a 1x1 tracking pixel. | ||||||||||||||||||||||
| * Checks both HTML attributes and computed natural dimensions. | ||||||||||||||||||||||
| * @param {HTMLElement} node - The node to check | ||||||||||||||||||||||
| * @return {boolean} True if image is a 1x1 tracking pixel | ||||||||||||||||||||||
| */ | ||||||||||||||||||||||
| function isTrackingPixel( node ) { | ||||||||||||||||||||||
| // Check HTML width/height attributes | ||||||||||||||||||||||
| const widthAttr = node.getAttribute( 'width' ); | ||||||||||||||||||||||
| const heightAttr = node.getAttribute( 'height' ); | ||||||||||||||||||||||
| if ( widthAttr === '1' && heightAttr === '1' ) { | ||||||||||||||||||||||
| return true; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
Comment on lines
+100
to
+104
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using strict string equality (
Suggested change
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // Check computed natural dimensions (e.g. for base64 or loaded images without explicit attributes) | ||||||||||||||||||||||
| if ( | ||||||||||||||||||||||
| typeof node.naturalWidth === 'number' && | ||||||||||||||||||||||
| typeof node.naturalHeight === 'number' && | ||||||||||||||||||||||
| node.naturalWidth === 1 && | ||||||||||||||||||||||
| node.naturalHeight === 1 | ||||||||||||||||||||||
| ) { | ||||||||||||||||||||||
| return true; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| return false; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /** | ||||||||||||||||||||||
| * Check if image should be ignored due to plugin-specific cases | ||||||||||||||||||||||
| * @param {HTMLElement} node - The node to check | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -39,6 +39,21 @@ describe( 'Link Improper Rule', () => { | |||||||||||||||||||||||||||||||
| html: '<a href="javascript:void(0)">Bad practice</a>', | ||||||||||||||||||||||||||||||||
| shouldPass: false, | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||
| name: 'Fails when anchor has javascript: href with leading whitespace', | ||||||||||||||||||||||||||||||||
| html: '<a href=" javascript:alert(1)">Bad practice</a>', | ||||||||||||||||||||||||||||||||
| shouldPass: false, | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||
| name: 'Fails when anchor href contains only whitespace', | ||||||||||||||||||||||||||||||||
| html: '<a href=" ">Whitespace link</a>', | ||||||||||||||||||||||||||||||||
| shouldPass: false, | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||
| name: 'Fails when anchor href contains only whitespace', | ||||||||||||||||||||||||||||||||
| html: '<a href=" ">Whitespace link</a>', | ||||||||||||||||||||||||||||||||
| shouldPass: false, | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
|
Comment on lines
+47
to
+56
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a duplicate test case for 'Fails when anchor href contains only whitespace' in this file. Please remove the redundant test case to keep the test suite clean and maintainable.
Suggested change
|
||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||
| name: 'Fails when anchor has malformed URL', | ||||||||||||||||||||||||||||||||
| html: '<a href="http://example.com:invalid-port">Invalid URL</a>', | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the general rules, the use of
!importantis acceptable only when accompanied by an explanatory comment. Please add a comment explaining why!importantis required for this box-shadow rule.References