Ask a Question related to Macromedia Exchange Dreamweaver Extensions, Design and Development.
-
E Michael Brandt #1
Extension development question
I have spent several frustrating hours trying to make a Command smart
enough NOT to process a document containing malformed html (i.e. html
that does not contain html, head, and body tags, like that in an
Include file.) But it seems that the DW API outfoxes me at every turn:
If I experiment with a document that LACKS those tags, DW *invents*
them so they are present in the document innerHTML, and are present in
the DOM tree as well.
Does anyone know a way around this? Any way to properly detect that a
document lacks any one or all of <html>, <body> and <head> tags?
Thanks.
emichael brandt
E Michael Brandt Guest
-
No WML development extension for DW8?
For some mysterious reason, no one can find a WML development extension for DW8. I must be missing a point here, has it been approached differently?... -
DW Extension Development Forum not working?!
Hello all, Trying to login to the devforums for DW extensions and it seems that it is not available. Does anyone know if this is down for good or... -
perl template tool kit extension development
Greetings, I would like to develop an extension to dreamweaver to allow DW to visually display the perl Template Toolkit .wld files. For those... -
Question about install Development utiliies on Linux Redhat 7.0
I install Linux RedHat 7.0 on my Pentium III system..Now I would like to compile the Xfree86 4.3.0 source codes to support my Nvidia GeForce2 MX400... -
Development best practices and knowing when to exercise control over development
Hi Nuno, After analyzing your message, I found that most of it was purely theoretical. The actual issue you discussed was regarding how to... -
Phil #2
Re: Extension development question
Maybe you could try with a regexp ?
function runCmd(){
var leDOM = dw.getDocumentDOM();
var html = leDOM.getElementsByTagName('html')[0];
var content = html.outerHTML;
var reg = /<html>/gi;
if (reg.test(content)) {
alert('good');
// Process
} else {
alert('bad');
return;
}
window.close();
}
>
> Does anyone know a way around this? Any way to properly detect that a
> document lacks any one or all of <html>, <body> and <head> tags?
>
> Thanks.
>
> emichael brandt
Phil Guest
-
E Michael Brandt #3
Re: Extension development question
You hit the nail just right.
I am now using this code and it is working nicely. Thanks:
var h=dw.getDocumentDOM().getElementsByTagName('HTML')[0].outerHTML ;
if (h.search(/<html[^>]*>/i)==-1 || h.search(/<head[^>]*/i) ==-1 ||
h.search(/<body[^>]*/i) ==-1){ ...
It is so interesting to me that the DW API returns a html element and
then does not find "html" in the elements outerHtml.
Similarly I have found that findElementsByTagName('UL'). e.g., will
detect ULs in Included files, but if you then try to check the innerHTML
of one of those UL nodes, DW returns instead the Include directive itself.
Thanks so much for the solution.
emichael brandt
Phil wrote:> Maybe you could try with a regexp ?
>
> function runCmd(){
> var leDOM = dw.getDocumentDOM();
>
> var html = leDOM.getElementsByTagName('html')[0];
> var content = html.outerHTML;
> var reg = /<html>/gi;
>
> if (reg.test(content)) {
> alert('good');
> // Process
>
> } else {
> alert('bad');
> return;
> }
>
> window.close();
> }
>
>
>>>> Does anyone know a way around this? Any way to properly detect that a
>> document lacks any one or all of <html>, <body> and <head> tags?
>>
>> Thanks.
>>
>> emichael brandt
>E Michael Brandt Guest



Reply With Quote

