Replace href=javascript:; with bootstrap link class (#7797)

Fixes #7792

Bootstrap styles `a:has([href])` as a link so the attribute had been
used in the past for things that aren't actually links, yet we want the
style for. It's better to just use `.link-primary` so it doesn't affect
the contents as discovered in #7792
This commit is contained in:
Mats Jun Larsen
2025-06-13 02:43:14 +09:00
committed by GitHub
parent e2a834bcc8
commit 47e8e6d3a7
11 changed files with 27 additions and 27 deletions

View File

@@ -1792,7 +1792,7 @@ export class Compiler extends MonacoPane<monaco.editor.IStandaloneCodeEditor, Co
offerViewInSpeedscope(artifact: Artifact): void {
this.alertSystem.notify(
'Click ' +
'<a target="_blank" id="download_link" style="cursor:pointer;" click="javascript:;">here</a>' +
'<a class="link-primary" target="_blank" id="download_link" style="cursor:pointer;">here</a>' +
' to view ' +
artifact.title +
' in Speedscope',
@@ -1822,7 +1822,7 @@ export class Compiler extends MonacoPane<monaco.editor.IStandaloneCodeEditor, Co
offerViewInPerfetto(artifact: Artifact): void {
this.alertSystem.notify(
'Click ' +
'<a target="_blank" id="download_link" style="cursor:pointer;" click="javascript:;">here</a>' +
'<a class="link-primary" target="_blank" id="download_link" style="cursor:pointer;">here</a>' +
' to view ' +
artifact.title +
' in Perfetto',
@@ -1863,7 +1863,7 @@ export class Compiler extends MonacoPane<monaco.editor.IStandaloneCodeEditor, Co
this.alertSystem.notify(
'Click ' +
'<a target="_blank" id="miracle_emulink" style="cursor:pointer;" click="javascript:;">here</a>' +
'<a target="_blank" id="miracle_emulink" style="cursor:pointer;" class="link-primary">here</a>' +
' to emulate',
{
group: 'emulation',
@@ -1895,7 +1895,7 @@ export class Compiler extends MonacoPane<monaco.editor.IStandaloneCodeEditor, Co
this.alertSystem.notify(
'Click ' +
'<a target="_blank" id="jsspeccy_emulink" style="cursor:pointer;" click="javascript:;">here</a>' +
'<a target="_blank" id="jsspeccy_emulink" style="cursor:pointer;" class="link-primary">here</a>' +
' to emulate',
{
group: 'emulation',
@@ -1926,7 +1926,7 @@ export class Compiler extends MonacoPane<monaco.editor.IStandaloneCodeEditor, Co
const dialog = $('#jsbeebemu');
this.alertSystem.notify(
'Click <a target="_blank" id="emulink" style="cursor:pointer;" click="javascript:;">here</a> to emulate',
'Click <a target="_blank" id="emulink" style="cursor:pointer;" class="link-primary">here</a> to emulate',
{
group: 'emulation',
collapseSimilar: true,
@@ -1956,7 +1956,7 @@ export class Compiler extends MonacoPane<monaco.editor.IStandaloneCodeEditor, Co
const dialog = $('#jsnesemu');
this.alertSystem.notify(
'Click <a target="_blank" id="emulink" style="cursor:pointer;" click="javascript:;">here</a> to emulate',
'Click <a target="_blank" id="emulink" style="cursor:pointer;" class="link-primary">here</a> to emulate',
{
group: 'emulation',
collapseSimilar: true,
@@ -1984,7 +1984,7 @@ export class Compiler extends MonacoPane<monaco.editor.IStandaloneCodeEditor, Co
emulateC64Prg(prg: Artifact): void {
this.alertSystem.notify(
'Click <a target="_blank" id="emulink" style="cursor:pointer;" click="javascript:;">here</a> to emulate',
'Click <a target="_blank" id="emulink" style="cursor:pointer;" class="link-primary">here</a> to emulate',
{
group: 'emulation',
collapseSimilar: true,
@@ -2011,8 +2011,8 @@ export class Compiler extends MonacoPane<monaco.editor.IStandaloneCodeEditor, Co
const dialog = $('#gbemu');
this.alertSystem.notify(
'Click <a target="_blank" id="emulink" style="cursor:pointer;" click="javascript:;">here</a> to emulate with a debugger, ' +
'or <a target="_blank" id="emulink-play" style="cursor:pointer;" click="javascript:;">here</a> to emulate just to play.',
'Click <a target="_blank" id="emulink" style="cursor:pointer;" class="link-primary">here</a> to emulate with a debugger, ' +
'or <a target="_blank" id="emulink-play" style="cursor:pointer;" class="link-primary">here</a> to emulate just to play.',
{
group: 'emulation',
collapseSimilar: true,

View File

@@ -697,7 +697,7 @@ export class Executor extends Pane<ExecutorState> {
offerViewInSpeedscope(artifact: Artifact): void {
this.alertSystem.notify(
'Click ' +
'<a target="_blank" id="download_link" style="cursor:pointer;" click="javascript:;">here</a>' +
'<a target="_blank" id="download_link" style="cursor:pointer;" class="link-primary">here</a>' +
' to view ' +
artifact.title +
' in Speedscope',

View File

@@ -520,7 +520,7 @@ export class Tool extends MonacoPane<monaco.editor.IStandaloneCodeEditor, ToolSt
elem.empty();
const editorId = unwrap(this.compilerInfo.editorId);
$('<a></a>')
.prop('href', 'javascript:;')
.addClass('link-primary')
.html(msg)
.on('click', e => {
this.eventHub.emit('editorSetDecoration', editorId, lineNum, true, column);

View File

@@ -74,8 +74,8 @@ function reallySetCompilerVersionPopover(
'<br/>';
const hiddenVersionText = $('<div>').html(lines).hide();
const clickToExpandContent = $('<a>')
.attr('href', 'javascript:;')
.text('Toggle full version output')
.addClass('link-primary')
.on('click', () => {
versionContent.toggle();
hiddenVersionText.toggle();

View File

@@ -50,15 +50,15 @@ block prepend content
span.fa.fa-info-circle
span.hideable.shortlinkInfoText
li.nav-item.ui-presentation-control.d-none
a.nav-link.ui-presentation-first(href="javascript:;")
a.nav-link.ui-presentation-first.link-primary
span.dropdown-icon.fas.fa-fast-backward
| Start
li.nav-item.ui-presentation-control.d-none
a.nav-link.ui-presentation-prev(href="javascript:;")
a.nav-link.ui-presentation-prev.link-primary
span.dropdown-icon.fas.fa-backward
| Previous
li.nav-item.ui-presentation-control.d-none
a.nav-link.ui-presentation-next(href="javascript:;")
a.nav-link.ui-presentation-next.link-primary
span.dropdown-icon.fas.fa-forward
| Next
@@ -80,17 +80,17 @@ block prepend content
// use `data-bs-toggle="modal"` on the `<a>` itself, as that would prevent the clipboard button from working.
// Bootstrap's default blanket event handler beats out any event handler we manually attach to the button.
if storageSolution !== "null"
a.dropdown-item#shareShort(href="javascript:;" data-bs-target="#sharelinkdialog" data-bind="Short")
a.dropdown-item.link-primary#shareShort(data-bs-target="#sharelinkdialog" data-bind="Short")
span.dropdown-icon.fas.fa-cloud.d-inline
| Short Link
button.btn.btn-sm.copy-link-btn.clip-icon.float-end(data-bs-target="" data-bs-toggle="none")
span.dropdown-icon.fa.fa-clipboard
a.dropdown-item#shareFull(href="javascript:;" data-bs-target="#sharelinkdialog" data-bind="Full")
a.dropdown-item.link-primary#shareFull(data-bs-target="#sharelinkdialog" data-bind="Full")
span.dropdown-icon.fas.fa-store-slash.d-inline
| Full Link
button.btn.btn-sm.copy-link-btn.clip-icon.float-end(data-bs-toggle="none")
span.dropdown-icon.fa.fa-clipboard
a.dropdown-item#shareEmbed(href="javascript:;" data-bs-target="#sharelinkdialog" data-bind="Embed")
a.dropdown-item.link-primary#shareEmbed(data-bs-target="#sharelinkdialog" data-bind="Embed")
span.dropdown-icon.fas.fa-window-restore.d-inline
| Embed in iframe
// This is not an oversight, there is in fact a .float-end missing here that's there in the other 2

View File

@@ -6,7 +6,7 @@ block content
input#filterAnsi(name='filterAnsi' value='true' type='hidden')
.form-pair.inlined.dropdown
a.btn.nodropdown-toggle#outputDropdown(href="javascript:;" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false")
a.btn.link-primary.nodropdown-toggle#outputDropdown(role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false")
span.fas.fa-cog
| Output
@@ -14,7 +14,7 @@ block content
include ../options-output.pug
.form-pair.inlined.dropdown
a.btn.nodropdown-toggle#filtersDropdown(href="javascript:;" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false")
a.btn.link-primary.nodropdown-toggle#filtersDropdown(role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false")
span.fas.fa-filter
| Filters

View File

@@ -1,7 +1,7 @@
block footer
nav.bg-light
if mobileViewer
a.btn.nodropdown-toggle#otherDropdown(href="javascript:;" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false") Other
a.btn.link-primary.nodropdown-toggle#otherDropdown(role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false") Other
.noscriptdropdown(aria-labelledby="otherDropdown")
include ../menu-other.pug

View File

@@ -1,7 +1,7 @@
block header
nav.bg-light
if mobileViewer
a.btn.nodropdown-toggle#languageDropdown(href="javascript:;" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false") Language
a.btn.link-primary.nodropdown-toggle#languageDropdown(role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false") Language
.noscriptdropdown(aria-labelledby="languageDropdown")
each language in languages

View File

@@ -12,7 +12,7 @@
ul.historiccode(style="list-style-type: none;")
li.template
input.preview(type="radio" name="preview" style="margin-right: 10px;")
a(href="javascript:;")
a.link-primary
div.src-content#load-history-src-display(style="height:600px;overflow-y:scroll;flex:2")
div.monaco-placeholder
.modal-footer

View File

@@ -16,12 +16,12 @@
#load-examples.tab-pane.active(role="tabpanel")
h4.card-title Load from examples:
ul.examples.small-v-scrollable
li.template: a(href="javascript:;")
li.template: a.link-primary
#load-browser-local.tab-pane(role="tabpanel")
h4.card-title Load from browser-local storage:
ul.local-storage.small-v-scrollable
li.template
a.me-3(href="javascript:;")
a.me-3.link-primary
button.overwrite.btn.btn-sm.btn-light.me-1
span.fa.fa-edit.me-1
| Overwrite
@@ -34,7 +34,7 @@
#load-browser-local-history.tab-pane(role="tabpanel")
h4.card-title Load from browser-local history:
ul.local-history.small-v-scrollable
li.template: a(href="javascript:;")
li.template: a.link-primary
#load-file-system.tab-pane(role="tabpanel")
h4.card-title Load/save to your system
.mb-3

View File

@@ -1,3 +1,3 @@
#share-item
a.share-item(href="javascript:;" rel="noopener noreferrer" target="_blank")
a.share-item.link-primary(rel="noopener noreferrer" target="_blank")
span.share-item-text