Skip to content

Commit

Permalink
Panel: Generate header id manually
Browse files Browse the repository at this point in the history
We use [email protected] to generate our header id.

[email protected] is reported to be unsafe and contains vulnerabilities [1].

As a step towards removing [email protected] as a dependencies, let's replace
all usage of the 'string' methods with suitable equivalents.

[1] - jprichardson/string.js#212
  • Loading branch information
yamgent committed Aug 3, 2018
1 parent 86dc5ea commit b7739ae
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/Panel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@
import md from './utils/markdown.js'
import panelSwitch from './PanelSwitch.vue'
import retriever from './Retriever.vue'
const string = require('string');
export default {
components: {
Expand Down Expand Up @@ -299,7 +297,7 @@
if (this.headerContent) {
const panelHeaderText = jQuery(this.headerContent).wrap('<div></div>').parent().find(':header').text();
if (panelHeaderText) {
this.$refs.cardContainer.setAttribute('id', string(panelHeaderText).slugify().toString());
this.$refs.cardContainer.setAttribute('id', String(panelHeaderText).trim().toLowerCase().replace(/\s+/g, '-'));
}
} else if (this.$refs.headerWrapper.innerHTML) {
const header = jQuery(this.$refs.headerWrapper.innerHTML).wrap('<div></div>').parent().find(':header');
Expand Down

0 comments on commit b7739ae

Please sign in to comment.