|
I use MooTools, and I need to find the element which has both classes "a" and "b" (the innermost div in my example below).
The HTML structure is:
<div class="a"> <div class="otherclass"> <div class="b"></div> </div> </...
Started by Nir on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
What about
$$('div.a div.b')
or
$$("div.a").getElements("div.b");
var divsB = $$("div.a div.b");
http://mootools.net/shell/jfnWK/ - selects the first one but not the second as it's not a child of a div.a .
|
|
I want to write some javascript classes which extend DOM nodes (so that I can then insert instances of my class directly into the DOM), but am having difficulty finding out which class/prototype I should inherit from.
eg
function myExtendedElement() {...
Started by wheresrhys on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
The....
At least, it enables me to access the extended object properties via the DOM element from DOM element, you need to have access to that element's prototype.
You can simply add new functions to the DOM prototypes, eg that works...
|
|
What is the meaning of DOM element in the following statements?
Statement #1
You can add multiple classes to a single DOM element.
Statement #2
The -- point is that inheritance in CSS is done not through classes, but through element hierarchies. So to...
Started by Masi on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
A DOM....
The DOM is the way Javascript sees, as well as the browser state.
Document object model.
HTML is used to build the DOM which is an in-memory CSS and Javascript interact with the DOM.
It's actually Document Object Model.
|
Ask your Facebook Friends
|
In Javascript, you can extend existing classes by using its prototype object:
String.prototype.getFirstLetter = function() { return this[0]; };
Is it possible to use this method to extend DOM elements?
Started by nickf on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Plus re-extending every new.
However, this does (by "anything" I mean native DOM objects) - that will only lead to bad things.
() { return this.id; };
you can extend the DOM by using the Element's prototype.
|
|
I am looking for a good API documentation for Javascript especially related to browsers and DOM. I am not looking for any kind of Javascript tutorial, but simply a documentation for all standard Javascript classes and for classes used in web browsers....
Started by Juha Syrjälä on
, 8 posts
by 8 people.
Answer Snippets (Read the full thread at stackoverflow):
I'm rather fond.
Https://developer.mozilla.org/
The DOM section of it is probably what you look for, alongside with Javascript.
Gecko DOM Reference
JavaScript Kit - DOM Reference
And many more .
|
|
I am writing a jQuery plugin and I am at the optimization stage.
I wonder which of these leads to a quicker script in general, and what sort of mitigating factors are important:
Have the script generate lots of classes and ids at the start so finding ...
Started by wheresrhys on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
By "hooks" I mean IDs or classes....
Do also remember that getting nodes by class is always slower than getting them by id.
I think you should go with the first choice.
Adding classes and ids to nodes will prevent such scenarios.
Brittle.
|
|
Hi I'm new to dom parsing on php:
I have an html file that I'm trying to parse. It has a bunch of div's like this:
<div id="interestingbox"> <div id="interestingdetails" class="txtnormal"> <div>Content1</div> <div>Content...
Started by chris on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
dom_xpath->query("*/div[@class='interestingbox']"); [...] //OUTPUT [div] { Content1 Content2 to tell you that you can't use the same id on two different divs; there are classes for that point id="interestingdetails" class....
|
|
In javascript, what are the pro's and con's of encoding an onclick event in the DOM and in the HTML itself?
Which, if either, is better than the other and why?
Started by johnnietheblack on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
It is even better to use proper DOM events ( addEventListener and attachEvent ) rather than.
Attaching events to an CSS-style ID (or classes), as Jquery does so says.
Everything down all at once.
|
|
When using $("#xxx") I guess under the hoods jQuery uses getElementById .
What about $(".xxx") does it scan the whole DOM every time?
Started by flybywire on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
JQuery attempts to use the fastest selection://www.componenthouse.com/article-19
http:....
Many browsers do not support getElementsByClassName as a native DOM function, so jQuery has to do the work itself by checking each element's classes.
|
|
Can I test my client side GWT code without GWTTestCase? I've heard somewhere (I think it was one of the Google IO 2009 conferences) that they were successfully testing their code with a fake DOM, in the JVM and not in Javascript with the DOM. That would...
Started by Eugen on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
By doing this, you, without the need for a browser... .
Any code that requires the DOM should go in your View classes/Presenter pattern and abstract away all the DOM-accessing code to the 'View' portion.
The Model-View-Presenter pattern.
|