Toby, what exactly are you meaning by "tag-soup" mode? I'm sure you don't mean "quirks" mode, but I'm not sure what you do mean.

My main reason for moving in this direction is threefold:

1) It lets me validate my code at a higher level.

2) I did not want the browsers using quirks mode.

3) I wanted to get rid of <applet> and move to <object>, and it was too tricky to do this myself.

4) I wanted to let someone else work on getting all the multiple-issue browser stuff taken care of.

All of these are satisfied better for me by using Jmol.js than by not using 
Jmol.js.

You make a good point about document.write(), though. I've just started reading about this, and it's nuts. Obviously what is needed is a document.writeVerified() that allows me to put out chunks of valid code, but I guess that doesn't exist. You are right, I'm sure my server is pushing these as "text/html" and that is why they are being parsed more as HTML 4.0 Strict than as XHTML 1.0 Strict.

But the reason for using Jmol.js is more significant than that. The reason is that Jmol.js AS IT STANDS NOW, can be used with no document.write(). So that allows any functionality that you can think of to dynamically present the page in some DOM-directed fashion. That's the big change as of this week -- no longer a document.write() dependence in Jmol.js. Is that your only objection?

I'm certainly no expert -- just getting started with XHTML, and so most of what you have below is still vague to me.

Instead, you must append tags as DOM nodes using the javascript DOM interface. (This causes complications if you're trying to output static html as Jmol.js does, since there may not be a complete DOM tree available at that point.)


Again, with the new Jmol.js, there is no need for immediate output of content with document.write(). Just use jmolSetDocument(0). For now.


What I do for my pages is the following: where I want a jmol
applet to be available, I have this:

<div id="parent_id">
  <input type="button" value="Activate Jmol viewer" 
onclick="javascript:toggleJmol([400,400],&quot;parent_id&quot;)">
  <applet style="display:none;"/>
</div>

How does this use of <applet> pass the XHTML validator? I get:

# Error Line 13 column 117: end tag for "input" omitted, but OMITTAG NO was specified.

...ol([400,400],&quot;parent_id&quot;)">

# Error Line 14 column 16: there is no attribute "style".

  <applet style="display:none;"/>

# Error Line 14 column 32: element "applet" undefined.

  <applet style="display:none;"/>

What am I missing? Or are you using a specialized dtd?



with toggleJmol defined as:

      function toggleJmol(sz, parentId) {
        // Grab parent node of structure we'll manipulate
        var parentNode = document.getElementById(parentId);
        // Find the applet & div nodes to be used.
        for (child = parentNode.firstChild; child != null; child = 
child.nextSibling) {
          switch(child.localName) {
            case 'input' :
              var inputNode = child;
              break;
            case 'applet' :
              var appNode = child;
              break;
          }
        }

Why not just give the input and applet tags ids directly? This seems very round-about going through the parent. I'm sure you have your reason...


        // and toggle:
        if (appNode.hasChildNodes()) {
          var newAppNode = 
document.createElementNS('http://www.w3.org/1999/xhtml','applet');
          var newMessage = 'Activate Jmol viewer';
        }
        else {
          cmlNode.setAttribute('xmlns:cml', 
'http://www.xml-cml.org/schema/CML2/Core');
          var newAppNode = jmolAppletNew(sz, filename, nameSuffix=parentId);
          var newMessage = 'Deactivate Jmol viewer';
        }
        parentNode.replaceChild(newAppNode, appNode);
        inputNode.setAttribute('value', newMessage);
      }

where jmolAppletNew works through the DOM interface, so instead
of document.write() calls, the following sort of thing is done:

var app; var p;
    app = document.createElementNS('http://www.w3.org/1999/xhtml','applet');
    app.setAttribute('name', 'jmolApplet' + nameSuffix);
    app.setAttribute('id', 'jmolApplet' + nameSuffix);
    app.setAttribute('code', 'JmolApplet');
    app.setAttribute('archive', archivePath);
    app.setAttribute('codebase', codebase);
    app.setAttribute('width', sz[0]);
    app.setAttribute('height', sz[1]);
    app.setAttribute('mayscript', true);
    p = document.createElementNS('http://www.w3.org/1999/xhtml','param');
    p.setAttribute('name', 'progressbar');
    p.setAttribute('value', 'true');
    app.appendChild(p);

etc., etc.


Can you point us to your modified Jmol.js that has JmolAppletNew() in it?

The reason that most of us use Jmol.js is that then we have the framework in place so that, should browsers move generally in this XML direction, then we don't have to do anything more then drop in a new Jmol.js or a DOM version of that. For the masses, the alternative is not to do what you are doing -- hardly any of us have your expertise -- the alternative is to use hard-coded HTML code.

So I really don't see your point here. Clearly, while I am moving in the direction of XML, Jmol.js is of use. Why wouldn't be? The whole idea is to abstract out the operation of generating the applet. If this is through your "extension of the DOM" method or not, that abstraction is good for me.

Can you give a few example pages that use your DOM model so we can see how those run on various browsers?

Thanks,

Bob Hanson


--
Robert M. Hanson, [EMAIL PROTECTED], 507-646-3107
Professor of Chemistry, St. Olaf College 1520 St. Olaf Ave., Northfield, MN 
55057
mailto:[EMAIL PROTECTED] http://www.stolaf.edu/people/hansonr



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to