Skip to content

Commit

Permalink
ace2_inner: Get computed style of first Element, not first Node
Browse files Browse the repository at this point in the history
`window.getComputedStyle()` throws if passed a non-Element Node.
  • Loading branch information
rhansen authored and SamTV12345 committed Sep 14, 2023
1 parent 216f5af commit bd5fae9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/static/js/ace2_inner.js
Original file line number Diff line number Diff line change
Expand Up @@ -3466,7 +3466,7 @@ function Ace2Inner(editorInfo, cssManagers) {
// use that for displaying the side div line number inline with the first line
// of content -- This is used in ep_headings, ep_font_size etc. where the line
// height is increased.
const elementStyle = window.getComputedStyle(docLine.firstChild);
const elementStyle = window.getComputedStyle(docLine.firstElementChild);
const lineHeight = parseInt(elementStyle.getPropertyValue('line-height'));
const marginBottom = parseInt(elementStyle.getPropertyValue('margin-bottom'));
lineHeights.push(lineHeight + marginBottom);
Expand Down

0 comments on commit bd5fae9

Please sign in to comment.