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 committed Jan 21, 2022
1 parent bdd6c41 commit 10e11e6
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 @@ -3462,7 +3462,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 10e11e6

Please sign in to comment.