W3C home > Mailing lists > Public > www-style@w3.org > May 1997

RE: DOM, markup, and "dynamic html"

From: Scott Isaacs <scotti@microsoft.com>
Date: Fri, 23 May 1997 15:04:46 -0700
Message-ID: <4175E9758584CF11927E00805F68ACFA02E04060@RED-99-MSG.dns.microsoft.com>
To: www-style@w3.org, "'Todd Fahrner'" <fahrner@pobox.com>
Answers below:

> ----------
> From: 	Todd Fahrner[SMTP:fahrner@pobox.com]
> Sent: 	Thursday, May 22, 1997 3:43 PM
> To: 	Scott Isaacs; www-style@w3.org
> Subject: 	RE: DOM, markup, and "dynamic html"
> 
> At 14:59 -0700 5.22.97, Scott Isaacs wrote:
> 
> > <H1 style="cursor: hand">Displays a hand over the header without the
> > need for the extra anchor</H1>
> 
> I recall some discussion of proposed extensions to CSS like "cursor
> style,"
> but can't find documentation. Is a list of CSS extensions in IE4
> available?
> 
1) IE4 in preview 2 will continue to improve on its CSS1 support, CSS
Positioning, CSS Font Embedding, and some CSS features still being
discussed within the CSS working group (cursor is one of them). 


> > 2) In preview 2, the src attribute on script will be supported to
> > reference external scripts. Scripts are not supported in CSS.
> 
> Can you say whether there will be some UI to assign "personal scripts"
> paralleling personal style sheets in IE4? (Or whether you think
> there's
> something to the idea?) Such scripts could mend some of the problems
> with
> "cascading" discussed here recently, and help establish a UI paradigm
> that
> might eventually accommodate dsssl-o or other more comprehensive
> "style
> programs."
> 
>> The idea of personal scripts in addition to personal style sheets is
an interesting idea. I need to give this some more thought.


> > 3) The DIV is wrapping the child content for simplicity reasons qand
> was
> > purely an implementation decision on my part. Examining the code,
> you
> > will notice that this example took a total of 6 lines of code for
> all
> > the expanding and collapsing in the document. The code is
> generalized
> > enough for any document that is properly authored to take advantage
> of
> > expanding and collapsing.  While I didn't do it, it is also possible
> to
> > even generalize the code even further to require none of the extra
> > markup and be completely generalized.> I was too overworked to take
> this
> > on at the time I authored the code :-) However, I have written code
> that
> > can make any bulleted lists expand and collapse without any
> additional
> > markup beyond pasting a script or reference to the script in the
> > document. The code works by tracking all clicks in the document,
> > checking the scope of the click (is it in a bulleted list), and if
> so
> > then hides or shows any child lists if they exist.
> 
> I can't tell whether this means you are surfacing an object tree, or
> whether you have devised a workaround that delivers comparable
> functionality. Can you clarify?
> 
>> IE4 surfaces every element in the HTML document as a fully
programmable object. This includes access to all the elements known
attributes, any unknown attributes or values specified on the element,
and the element's style sheet. Each element also exposes information on
its ordinal index into a flattened HTML tree, and a pointer to its
parent element. There is no distinct children collection exposed on each
element. However, since you have access to an elements parent, and
ordinal position of elements, the children collection can be easily
simulated and scripts can be generically written against a document.

For those familiar with javascript or vbscript, these elements are
exposed through an "all" collection on the document.

Few simple examples of accessing the all collection:

document.all.length  ' # of elements in the document
document.all[23].tagName ' the tag name of the 23rd element in the
document
document.all["myElement"].parentElement.tagName ' the tag name of the
element that contains the element with the ID of "myElement"

Below demonstrates how to check if the user clicks within the scope of a
"H1"  anywhere in the document. This script can be pasted into the page
and requires no other modifications to the HTML. (doing this quickly so
there may be a syntax error)

<SCRIPT LANGUAGE="javascript">
function inH1() {
  var src=event.srcElement  // the element that the event originated
over
  /* look to see if any parents of this element is an H1. Continue until
the root of the document is reached. */
  while !("HTML"==src.tagName)  {
     if ("H1"==src.tagName) {
       // do something special
      return 
     }
     src=src.parentElement 
  }
  
}

document.onclick = inH1
</SCRIPT>

-Scott

> I am very happy to hear that it works either way, and thank you for
> having
> sacrificed a few precious metabolic cycles to reply.
> 
> ________________________________________
> Todd Fahrner
> mailto:fahrner@pobox.com
> http://www.verso.com/
> 
> The printed page transcends space and time. The printed page, the
> infinitude of books, must be transcended. THE ELECTRO-LIBRARY.
> 
> --El Lissitzky, 1923
> 
> 
Received on Friday, 23 May 1997 18:06:04 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:53:50 GMT