Adobe Extending Dreamweaver CS4 User Manual

Page 132

Advertising
background image

126

EXTENDING DREAMWEAVER CS4

Browser compatibility check issues API

ColAndColgroupCapturedByCaption.htm

<!DOCTYPE HTML SYSTEM "-//

//DWExtension layout-engine 5.0//dialog">
<html>
<head>
<title>Col and Colgroup Captured by Caption</title>

<script src="../../Shared/Common/Scripts/dwscripts.js"></script>
<script src="issue_utils.js"></script>
<script src="ColAndColgroupCapturedByCaption.js"></script>
<script>
//--------------- LOCALIZEABLE GLOBALS------------------
var ISSUE_NAME = "Col and Colgroup/Caption Conflict";
var ISSUE_DESC = "If the caption tag is placed directly after the opening table tag as required
by the HTML 4.01 specification, any styles applied to col and colgroup tags in the same table
are ignored.";

//--------------- END LOCALIZEABLE---------------
</script>
</head>

<body>
</body>
</html>

ColAndColgroupCapturedByCaption.js

function findIssue(){

var DOM = dw.getDocumentDOM();
var issueNodes = new Array();

if (DOM){
// first see if there are any caption tags in the doc.
var captions = DOM.getElementsByTagName('caption');

// declare a mess of variables that we'll need in the
// for loop below.
var currCap = null, props = null, parentTable = null;
var colgroups = null, cols = null, allcol = null;
var property = "", definedStyles = new Array();

// ok, now loop through all the captions, if any.
for (var i=0; i < captions.length; i++){
currCap = captions[i];
parentTable = currCap.parentNode;

// the caption is only a problem if it's in the valid
// spot (i.e., the first child of the table)
if (currCap == parentTable.childNodes[0]){

// find all colgroup and col tags that are in the
// same table as the caption.
colgroups = parentTable.getElementsByTagName('colgroup');
cols = parentTable.getElementsByTagName('col');
allcol = colgroups.concat(cols);

for (var x=0; x < allcol.length; x++){

Advertising
This manual is related to the following products: