Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Preserve videos in paragraphs without text - #1041

Open
ahmednajaf wants to merge 1 commit into
mozilla:mainfrom
ahmednajaf:fix/preserve-video-paragraphs
Open

ahmednajaf wants to merge 1 commit into
mozilla:mainfrom
ahmednajaf:fix/preserve-video-paragraphs

Conversation

@ahmednajaf

Copy link
Copy Markdown

Fixes #957.

Paragraph cleanup treats a <p> containing only a native <video> as empty and removes it. This also affects video-only <div> elements that Readability converts to paragraphs, including the video on the Shortwave page in the issue.

Count video alongside the media elements already preserved during paragraph cleanup. Add a reduced regression fixture covering a direct video URL, a nested source, a video-only div and an inline wrapper, while still removing a genuinely empty paragraph. Add an Unreleased changelog entry.

Validation on macOS with Node v24.11.0:

  • The content regression fails on the original code with both jsdom and JSDOMParser; all 13 fixture checks pass after the change.
  • npm test: 1,997 passing.
  • npm run lint: passes.
  • The downloaded Shortwave page preserves its original video source after the fix; extracted text length is unchanged. No Firefox integration test or media playback test was run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Preserve videos in paragraphs

1 participant