background preloader

DOM Enlightenment - Exploring the relationship between JavaScript and the modern HTML DOM

DOM Enlightenment - Exploring the relationship between JavaScript and the modern HTML DOM
Related:  DOM (Document Object Model)

How Browsers Work: Behind the scenes of modern web browsers Web browsers are the most widely used software. In this primer, I will explain how they work behind the scenes. We will see what happens when you type google.com in the address bar until you see the Google page on the browser screen. The browsers we will talk about There are five major browsers used on desktop today: Chrome, Internet Explorer, Firefox, Safari and Opera. The browser's main functionality The main function of a browser is to present the web resource you choose, by requesting it from the server and displaying it in the browser window. The way the browser interprets and displays HTML files is specified in the HTML and CSS specifications. Browser user interfaces have a lot in common with each other. Address bar for inserting a URIBack and forward buttonsBookmarking optionsRefresh and stop buttons for refreshing or stopping the loading of current documentsHome button that takes you to your home page The browser's high level structure The browser's main components are (1.1): Syntax:

JSbooks - free javascript books How to manipulate the DOM in Vanilla JavaScript - freeCodeCamp.org - Medium So you have learned variables, selection structures, and loops. Now it is time to learn about DOM manipulation and to start doing some cool JavaScript projects. In this tutorial, we will learn how to manipulate the DOM with vanilla JavaScript. Before we dive into coding, let’s learn what the Dom really is: The Document Object Model (DOM) is a programming interface for HTML and XML documents. Basically, when a browser loads a page it creates an object model of that page and prints it on the screen. A programming language can be used to access and modify this object model, and this action is called DOM manipulation. For the tutorial, we are going to need two files, one index.html, and the other manipulation.js. <! So there we have our HTML file, and as you can see we have a div with the id of division. 2.1. We can either access a single element or multiple elements. 2.1.1. For accessing a single element, we will look at two methods: getElementByID and querySelector. 2.1.2. 2.2. 2.3. 2.3.1.

How to recreate the new e-bay site scrolling effect In this tutorial we will try to recreate the scrolling effect you’ve seen on the new e-bay site. We’ll create a simple responsive one-page site presenting the beauty and benefits of lavender. No javascript needed – we will use only css. Step 1 – Prerequisities We will need 3 background images, that will stretch to full page width. Mine are about 1800px x 1200px. Step 2 – Html The markup is simple. <! Step 3 – basic css The wrapper class is defined as follows. Since we want each section and the header to behave responsively, we’ll use only percent units. The value of 4.16667% corresponds to 50px when the wrapper has its maximum width. You’ll find the complete stylesheet in the download files. Step 4 – the scrolling effect We don’t use any Javascript, our scrolling effect is obtained purely with css. We just have to assign the background image to each section Step 5 – last tweaks Since background-attachment:fixed is not supported in mobile Safari we’ll add the following media-query And that’s it!

Regular Expression Tutorial - Learn How to Use Regular Expressions This tutorial teaches you all you need to know to be able to craft powerful time-saving regular expressions. It starts with the most basic concepts, so that you can follow this tutorial even if you know nothing at all about regular expressions yet. The tutorial doesn't stop there. It also explains how a regular expression engine works on the inside, and alert you at the consequences. This helps you to quickly understand why a particular regex does not do what you initially expected. It will save you lots of guesswork and head scratching when you need to write more complex regexes. What Regular Expressions Are Exactly - Terminology Basically, a regular expression is a pattern describing a certain amount of text. This first example is actually a perfectly valid regex. \b[A-Z0-9._%+-]+@[A-Z0-9.-]+\. With the above regular expression pattern, you can search through a text file to find email addresses, or verify if a given string looks like an email address. Different Regular Expression Engines

JavaScript Guide - JavaScript The JavaScript Guide shows you how to use JavaScript and gives an overview of the language. If you need exhaustive information about a language feature, have a look at the JavaScript reference. This Guide is divided into the following chapters. Introduction Grammar and types Control flow and error handling Loops and iteration Functions Expressions and operators Numbers and dates Text formatting Indexed collections Keyed collections Working with objects Details of the object model Promises Iterators and generators

HTML-DOM Cheat Sheet DOM Events Event Object Constant Event Object Methods initEvent() preventDefault() stopPropagation() EventTarget Object addEventListener() dispatchEvent() removeEventListener() EventListener Object handleEvent() MouseEvent/KeyboardEvent Methods initMouseEvent() initKeyboardEvent() Elements Methods toString() HTML Object Properties align archive border code codeBase codeType data declare form height hspace name standby type useMap vspace width Dom Style Generated Content Properties content counterIncrement counterReset Ad

Mission: Impossible – iPad mini detection for HTML5 As you may know, the iPad mini is a new 7.9″ variant of the iPad tablet and one of the biggest questions out there today is how to detect it using server-side or client-side techniques. I have bad news for you: it seems impossible. Two days ago, I’ve tweeted about the first detected problem: “It is confirmed that the iPad Mini User Agent is the same as the iPad 2“. I’ve received literally hundreds of answers saying that user agent sniffing is a bad practice, that we should detect features not devices, etc, etc. Well yes guys, you are right, but it has no direct relationship with the problem. Why do we need to detect the iPad mini in first place The iPad Mini has no Retina display -the name that Apple gives to high resolution devices- and it’s an iPad 2 clone in terms of resolution: 768×1024 pixels. Ok, you are right; we don’t really need to care about iPad mini vs. iPad 2 in terms of the device itself, but we do need to care about the dpi difference. How to detect a feature or a device

Walkthrough: Creating a New Data-tier Application Project In this walkthrough, you create and configure a data-tier application (DAC) project, add objects, then build and deploy the DAC to a test instance of the SQL Server Database Engine. Tasks illustrated in this walkthrough include: How to create and configure a DAC project. How to configure a server selection policy for the DAC. How to add objects to a DAC project. How to build the DAC project to create a DAC package file that can be deployed to SQL Server 2008 R2. You must have installed Microsoft Visual Studio 2010 Beta 2 and SQL Server 2008 R2. To create a database project On the File menu, point to New, and click Project. To configure your project View the Solution Explorer to confirm that the SampleDAC project has been created and is open. To configure a server selection policy In Solution Explorer, expand the SampleDAC node, and then expand the Properties node. To add a table to the project To build the project To deploy the package by using Visual Studio

Related: