Backed out changeset 39212af55f82 (bug 1573473) for causing several browser chrome failures.

--HG--
extra : histedit_source : 7673911b1bfa661a37ac4721d577d9d373934824
This commit is contained in:
Cosmin Sabou 2019-08-20 00:23:11 +03:00
parent 2e5b997146
commit ebc3621600
4 changed files with 10 additions and 18 deletions

View File

@ -5,7 +5,6 @@
import { updateSelectedItem } from "../certviewer.js";
import { InfoGroup } from "./info-group.js";
import { ErrorSection } from "./error-section.js";
import { normalizeToKebabCase } from "../utils.js";
class CertificateSection extends HTMLElement {
constructor(certs, error) {
@ -126,7 +125,7 @@ class CertificateSection extends HTMLElement {
createTabSection(tabName, i, certificateTabs) {
let tab = document.createElement("button");
tab.textContent = tabName;
tab.setAttribute("id", normalizeToKebabCase(tabName));
tab.setAttribute("id", "tab" + i);
tab.setAttribute("aria-controls", "panel" + i);
tab.setAttribute("idnumber", i);
tab.setAttribute("role", "tab");

View File

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import { InfoItem } from "./info-item.js";
import { normalizeToKebabCase } from "../utils.js";
export class InfoGroup extends HTMLElement {
constructor(item) {
@ -25,7 +24,9 @@ export class InfoGroup extends HTMLElement {
// Adds a class with the section title's name, to make
// it easier to find when highlighting errors.
this.classList.add(normalizeToKebabCase(this.item.sectionTitle));
this.classList.add(
this.item.sectionTitle.replace(/\s+/g, "-").toLowerCase()
);
for (let i = 0; i < this.item.sectionItems.length; i++) {
this.shadowRoot.append(new InfoItem(this.item.sectionItems[i]));

View File

@ -2,8 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import { normalizeToKebabCase } from "../utils.js";
export class InfoItem extends HTMLElement {
constructor(item) {
super();
@ -25,7 +23,12 @@ export class InfoItem extends HTMLElement {
render() {
let label = this.shadowRoot.querySelector("label");
let labelText = normalizeToKebabCase(this.item.label);
let labelText = this.item.label
.replace(/\s+/g, "-")
.replace(/\./g, "")
.replace(/\//g, "")
.replace(/--/g, "-")
.toLowerCase();
label.setAttribute("data-l10n-id", "certificate-viewer-" + labelText);
this.classList.add(labelText);

View File

@ -57,14 +57,3 @@ export const hashify = hash => {
export const pemToDER = pem => {
return stringToArrayBuffer(window.atob(pem));
};
export const normalizeToKebabCase = string => {
let kebabString = string
.replace(/\s+/g, "-")
.replace(/\./g, "")
.replace(/\//g, "")
.replace(/--/g, "-")
.toLowerCase();
return kebabString;
};