...using unicode escape sequences: escapeHighASCII('{"foo":"xäy"}') // => '{"foo":"x\\u00e4y"}' Escaping high ASCII in JavaScript function escapeHighASCII(string) { let unicodeEscape = (char) => "\\u" + char.charCodeAt(0).toString(16).padStart(4, '0')
...focusable nor visible to screen readers. Alternatives If you're starting your transition from JavaScript, you can give the element the [inert] attribute. This will make the browser ignore input...
...to this element. Example DOM Breakpoints can be quite useful to quickly find the JavaScript that is responsible for some (unexpected) behavior. You can use DOM Breakpoints for debugging subtree...
...or node removal. Here you can see a very simple example that shows what JavaScript lines are responsible for a text change (subtree modification): You can use this Code Pen...
All major browsers (IE8+, FF3.5+, Safari 4+, any Chrome) support sessionStorage, a JavaScript storage object that survives page reloads and browser restores, but is different per new tab/window (in contrast...
...have many elements on our page. Clicking them should open a modal dialog. Vanilla JavaScript document.addEventListener('click', function(event) { if (event.target.closest('.dialog-link')) { // Open dialog } }); See Event delegation without jQuery...
...from the toolbar. For that, you should listen to the trix-initialize event in javascript. addEventListener("trix-initialize", event => { const { toolbarElement } = event.target const textTools = toolbarElement.querySelector("[data-trix-button-group=text...
...called a consent management platform (CMP). Your website will load this CMP via a JavaScript tag which will then directly render the form. The form will show the user detailed...
...See https://www.consentstringdecoder.com/ for an example string. The CMP will even inject a standardized JavaScript function called __tcfapi into your website. This can be used by any other third-party...
testing-library are widely used testing utilities libraries for javascript dependent frontend testing. The main utilities provided are query methods, user interactions, dom expectations and interacting with components of several...
...single-line texts. If you want to truncate tests across multiple lines, use a JavaScript solution like Superclamp. There is also -webkit-line-clamp which works only on Chrome.
...local development where you might still use http://. If you set any cookies from JavaScript, this isn't fixed by the middleware. Add this to lib/middleware/secure_cookies.rb: # On HTTPS requests, we...
...know about this. 0. Security considerations Each "like" button is implemented by including a Javascript on your site. This means you are running fucking remote code on your page. You...
...site is suggesting security by operating under HTTPS and you are still loading remote Javascript you are sort of full of shit. Even if you are cool with injecting remote...
...in web applications e.g. selects. It would require only a minimum of CSS and Javascript to get them working and looking good. The purpose of the Open UI, a W3C...
...is never reached. Note that this is not quite the same as "hoisting" in JavaScript. The variable is not available in the whole block, just in lines after its declaration...
...be able to click and drag to scroll), or resort to some kind of JavaScript solution...
...CoffeeScript to ES6. You can use decaffeinate to convert your CoffeeScript source to modern JavaScript. Install decaffeinate globally: npm install -g decaffeinate Call decaffeinate on each .coffee file, relaxing some...
Plot graphs in Ruby WebGraphviz renders in your browser via JavaScript (to store the rendered graph, extract the SVG using your browser's DOM inspector) GraphViz with DOT: Online...
...if it closes the tab entirely. It will not be dispatched when navigating via JavaScript. In this case you need to listen to other events. Quirks The "default behavior" in...
...icon font (plus stylesheets), but recently it can also be used as a pure JavaScript solution (which will render icons as inline tags), or even as SVG sprites.
...have their pros and cons: Icon font: little CPU load (no JavaScript) fonts are relatively large 1 extra HTTP request Javascript + inline SVG: higher CPU load (needs to watch the...
...the GA snippet into more than one website, maybe you've even used its Javascript API to implement tracking at the event level. Google Tag Manager (GTM) is a related...
...GTM (which makes GTM a huge XSS machine, actually). This goes even beyond injecting Javascript snippets and tracking page views. Even event tracking can be modeled inside GTM, using a...
making the whole page position: sticky; left: 0 capturing the scroll position with JavaScript and turning it into a transform: translateX on the table itself. Note that the table...
...add -p with single key presses Stash unstaged changes only with git stash -k JavaScript Create an object with no properties with Object.create(null) => {} The comma operator returns its last...
...toBe passes when first === second. Unfortunately this is useless for non-primitive values because JavaScript is a horrible language. However, Jasmine comes with another matcher toEqual: expect(first).toEqual(second...
...This is the same as finding an option with the { selected: true } property in JavaScript: select.querySelectorAll('option').find((option) => option.selected) What about the selected attribute? Note that option[selected] would...
...not once the user switched to a different value. It also won't work in JavaScript-heavy applications where you might not be rendering an option tag with the selected...
...Add a new link to your browser's bookmarks bar with the following URL. javascript:(() => { if (document.querySelector('[data-view-id="issue-view"]')) { const [id, ...words] = document.title.split(' ') ; prompt('Commit message:', `[${id...