Skip to content

Commit

Permalink
fix(components): [el-table] escape special html characters (#6520)
Browse files Browse the repository at this point in the history
* fix(components): [el-table] escape special html characters

* fix: use 3rd package
  • Loading branch information
msidolphin committed Mar 11, 2022
1 parent 0457032 commit 063c564
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"@vueuse/core": "^7.7.1",
"async-validator": "^4.0.7",
"dayjs": "^1.10.8",
"escape-html": "^1.0.3",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"lodash-unified": "^1.0.2",
Expand Down
2 changes: 2 additions & 0 deletions packages/components/table/src/util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createPopper } from '@popperjs/core'
import { get } from 'lodash-unified'
import escapeHtml from 'escape-html'
import { hasOwn, off, on } from '@element-plus/utils'
import { useZIndex } from '@element-plus/hooks'
import type {
Expand Down Expand Up @@ -326,6 +327,7 @@ export function createTablePopper(
const isLight = tooltipEffect === 'light'
const content = document.createElement('div')
content.className = `el-popper ${isLight ? 'is-light' : 'is-dark'}`
popperContent = escapeHtml(popperContent)
content.innerHTML = popperContent
content.style.zIndex = String(nextZIndex())
document.body.appendChild(content)
Expand Down
7 changes: 4 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 063c564

Please sign in to comment.