Tag: dom

javascript: check for blank textNode

What is the best way to check if a DOM text node is blank? By blank I mean only spaces, returns, tabs, etc. If it contains a nbsp; then it is NOT blank. I was doing: element.nodeValue.trim().length != 0 However, this also gets rid of nbsp;, which I do not want. (It’s for a Chrome […]

javascript&jquery: show URL parameters on load

I’m accessing the URL parameters with javascript. Then I manipulate the DOM with jQuery Mobile. But when I access the html file with the parameter, it doesn’t show. I need to refresh the page to make it work. What can I do? Javascript: <script type=”text/javascript” charset=”utf-8″> $(document).ready(function() { // Read a page’s GET URL variables […]

Getting the shape/outline of an HTML node in JavaScript

Is it possible to get the shape/outline of a DOM node in JavaScript? I would like to get some kind of representation of the shape or outline so that I can tell exactly which pixels the DOM node occupies. I can calculate the rectangle using width, height, and position, but this doesn’t take into account […]

Generate all HTML with JavaScript

I am making a Web application, and I’m wondering how far I should take JavaScript use. It’s a simple application that could be made in one page, and thus appear “app-like” and quickly responsive (using direct DOM manipulation combined with AJAX). I see three general ways I can take this: A) Generate all HTML on […]

Dynamically and Permanently Adding an Element to Your Page – Javascript/jQuery

I’m working on a website project from scratch. The content section of the main page has a form and a div of class “blog”. When the user is logged in on the admin account, the form shows up. This allows you to pick a title and content to post in the blog. The current code […]

Adding div dynamically, but images very slow to load

I’m creating divs dynamically based on ajax callbacks. Each div contains a single png image: var myDiv = “<div class=’myClass’ id=’divid’>” + “<img id=’newDiagDivId’ src=’images/approved-icon.png’>” + “<div style=’display:inline-block;vertical-align:top;’>blah</div>” + “</div>”; …here’s how I add it: $(myDiv).hide().appendTo( divContainer).fadeIn( 100); The div displays correctly formatted, but the png image takes about 5-10s to show up. It’s a […]

How can I send Current web page's whole HTML document to server?

how can I send my currently seeing web page(means javascript processed manipulated html documnet for user’s view – kind of interactive AJAX web pages) to server? Can I send ‘the documnet object mother of all html elements’ to server as it is?

Too high dom processing time in Android native browsers

I am currently trying to reduce the front end load time of my website. I followed various steps such as defer loading javascripts, using sprites, combining & minifying css/js files. I am already seeing a considerable reduction in page load time in major browsers. However, I could see that all android related native browsers have […]

Pitfalls using DOM-Javascript VS pure Javascript objects?

Background First of, I would like to mention, that a SO-search for figuring out differences of (host objects) DOM-Javascript Objects (var domJSobj = document.createElement(“div”)) and (native objects) pure Javascript Objects (var pureJSobj = {}) has been done, but still I cannot claim that I found very much (great is, that there is this question-answers: what-is-the-difference-between-native-objects-and-host-objects). […]

Move window to iframe without reloading

I wan’t to make a userscript that will persist with its instance even if I click on a link. To make a script instance (ie. variables etc) persist, I need to have the page I’m broswing in iframe, which is a child of the window where script is running. And also, parents document location must […]