dom

Get CSS style from PHP

I am parsing pages using Simple DOM parser. It is neat, but I would like to get the applied css style for each element. Not only the inline styles, but every style it applies to that element, being it inline, in-page or external. Is there a class that does that? If not, how would you do it? I do not really care about overriding styles, ...

Is there a way to get/save the DOM with Selenium ?

What I'm looking for is a method that works like "captureScreenshot(String path)", but instead of producing an image is saves the DOM as it currently is. Note that the existing getBodyText() method is not enough. ...

DOM element background images: load order

Dear all, I've been trying to understand how an html page loads with respect to background images. Firebug shows me that the background image for a wrapper div element is the last to load. I'm wondering if there's a way to coerce the background image to render before any of the contained images are loaded and displayed by a javascript....

HTML "overlay" which allows clicks to fall through to elements behind it

I'm trying to overlay a element on top of a webpage (to draw arbitrary graphics), and I've come to the point where I can stack it inside of a element on top of everything, but this prevents the user from clicking on any links/buttons/etc. Is there a way to have its content float on top of everything (it's semi-transparent, so you can s...

Deactivate link with DOM click event

This question is mainly out of curiosity (I have a different working solution to the issue). Trying to do some basic progressive enhancement: a table should have each row clickable to go to another page using JavaScript. For people w/out JavaScript, there's a link in the first column of each row. If JavaScript is enabled, the links shoul...

Is there a good way to attach javascript objects to HTML elements?

I want to associate a javascript object with an HTML element. Is there a simple way to do this. I noticed in the HTML DOM (http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html) defines a setAttribute method and it looks like this is defined for arbitrary attribute name. However this can only set string values. (You can of course use...

jquery live function for adding/removing rows

Hi, I' m trying to enable adding/deleting rows to/from table using folowing code: Script: $(document).ready(function() { $('#btnAdd').live('click', function() { var name = $('#txtName').val(); var name2 = $('#txtName2').val(); $("#tbNames tr:last").append("<tr><td>" + name + "</td><td>" + name2 + "</td><td><simg ssrc='del...

Does the choice of DOCTYPE affect the DOM as seen by javascript code?

Given a large legacy project utilizing ASP.NET, javascript, css, etc, technologies, I was wondering if changing the DOCTYPE of the web pages, say, from HTML 4.0 Transitional to XHTML 1.0 Transitional (or the other way around) in any way could break the javascript functions of the web pages. There are plenty of articles and discussions a...

Javascript OOP query re DOM

can you use parameters some how to alter 'book' and 'person' in this statement : book.borrower= person; eg JSObj.borrower = "SteveJobs"; I cannot seem to find a way, Is there one? ...

Determining font and size for text from HTML

I need to determine what font and size will be used for each HTML element. They may be set in various css, div, span, or on the element itself. If I were to do this manually I would start by looking at the element and work backwards until I came to span, div, or css that had a font and/or size. That is the value I want. The browser can ...

Preferred customizable progressively enhanced dropdowns/menus?

I was looking at what YUI had, http://developer.yahoo.com/yui/examples/button/btn%5Fexample07.html Can anyone recommend a library/plugin they used to progressively enhance native select element dropdowns at the request of a client? I know it's impossible to style a dropdown in IE, so it's either this or Flash which I don't want to get i...

How to select within a container with jQuery?

<div id="container1"> <span>...</span> </div> <div id="container2"> <span>...</span> </div> Say if I have get the jQuery object $('container1'),how to find the <span> in it? ...

Not in DOM after $.load() with jQuery?

var id = 'test'; var dom = $('#loader').clone().load("Views/chatBox.html"); dom.find('span.bn').text(id); in chatBox.html,there is : ... <span class="bn">AAA</span> ... I want to replace "AAA" with "test",but failed(dom.find can't fetch it),which mean it's not available instantly. How to do it the right way? ...

How can produce a DOCTYPE declaration with DOM level 3 serialization API?

I have a DOM Document created from scratch and I need to serialize it to an output stream. I am using DOM level 3 serialization API, like in the following example: OutputStream out; Document doc; DOMImplementationLS domImplementation = (DOMImplementationLS) DocumentBuilderFactory.newInstance().newDocumentBuilder().getDOMImplement...

window.parent is always undefined in an iframe

Hi there, I have recently ran into this strange issue, I was trying to reference parent window in an iframe, but somehow window.parent or parent are always undefined. I got around the problem by using window.top, but this question still haunts me. Why is window.parent undefined? This is a .NET web app, if it helps. Update: I would...

PHP Dom XML Parsing on empty self closing tags

HI Guys, I'm using DOM to parse an xml file. And I am having trouble catching an error that throws when the XML tag is empty and self closed. eg. <Title /> $xml=("http://www.exampleUrl.com/xmltoparse.xml"); $xmlDoc = new DOMDocument(); $xmlDoc->load($xml); $x=$xmlDoc->getElementsByTagName('Root'); for ($i=0; $i<=10; $i++) { $id=...

Listening to HTML Events from BHO

I've been working on a BHO/toolbar written in C# that listens to HTML events raised on the browser's current webpage. The solution includes a reusable class called HtmlPageEventManager whose purpose is to subscribe to a given list of HTML events for each new webpage that's opened. A goal is to attach handlers as soon as the user can be...

Add name attr to generated <span>

Hey, I am using this line of code: initWords($('<span></span>').addClass('word').text(data.word).appendTo('#wordBank')); Along with creating a <span class="word">word</span> I want too add name="WORD HERE" to the tag. I see that $(".word").attr("name"), but is this how I set the attr name to the span.word? Thanks, Ryan ...

IHTMLSelectionObject.createRange() throws UnauthorizedAccessException

I wrote the following code for retrieving the selected text from the current webpage: IHTMLDocument2 mainDoc = ... for ( int i = 0; i < mainDoc.frames.length; i++ ) { object refIndex = i; var frame = (IHTMLWindow2)mainDoc.frames.item( ref refIndex ); IHTMLDocument2 frameDoc; try { frameDoc = frame.document; } ca...

How to create a tree structure in Javascript DOM?

Hi, This is going to sound too silly / too basic - sorry about that, but I experimented a lot and couldn't come to the right solution! I'm using this following piece of code - which makes a row of text fields go up and down. Unfortunately, the up and down movement doesnt stop and carries on throughout the page! :) function up(row) { ...