コード例 #1
0
 @PatchMethod
 static TableCaptionElement createCaption(TableElement e) {
   TableCaptionElement caption = JavaScriptObjects.getObject(e, TCAPTION);
   if (caption == null) {
     caption = Document.get().createCaptionElement();
     JavaScriptObjects.setProperty(e, TCAPTION, caption);
     e.insertFirst(caption);
   }
   return caption;
 }
コード例 #2
0
  @PatchMethod
  static void setTHead(TableElement e, TableSectionElement tHead) {
    TableSectionElement old = JavaScriptObjects.getObject(e, THEAD);

    if (old != null && tHead != null) {
      e.replaceChild(tHead, old);
    } else if (tHead != null) {
      e.appendChild(tHead);
    } else {
      e.removeChild(old);
    }

    JavaScriptObjects.setProperty(e, THEAD, tHead);
  }
コード例 #3
0
  @PatchMethod
  static void setTFoot(TableElement e, TableSectionElement tFoot) {
    TableSectionElement old = JavaScriptObjects.getObject(e, TFOOT);

    if (old != null && tFoot != null) {
      e.replaceChild(tFoot, old);
    } else if (tFoot != null) {
      e.appendChild(tFoot);
    } else {
      e.removeChild(old);
    }

    JavaScriptObjects.setProperty(e, TFOOT, tFoot);
  }
コード例 #4
0
  @PatchMethod
  static TableSectionElement createTHead(TableElement e) {
    TableSectionElement thead = JavaScriptObjects.getObject(e, THEAD);
    if (thead == null) {
      thead = Document.get().createTHeadElement();
      TableCaptionElement caption = e.getCaption();
      if (caption == null) {
        e.insertFirst(thead);
      } else {
        e.insertAfter(thead, caption);
      }
      JavaScriptObjects.setProperty(e, THEAD, thead);
    }

    return thead;
  }
コード例 #5
0
  @PatchMethod
  static TableSectionElement createTFoot(TableElement e) {
    TableSectionElement tfoot = JavaScriptObjects.getObject(e, TFOOT);
    if (tfoot == null) {
      tfoot = Document.get().createTFootElement();

      TableSectionElement thead = e.getTHead();
      if (thead != null) {
        e.insertAfter(tfoot, thead);
      } else {
        TableCaptionElement caption = e.getCaption();
        if (caption == null) {
          e.insertFirst(tfoot);
        } else {
          e.insertAfter(tfoot, caption);
        }
      }
      JavaScriptObjects.setProperty(e, TFOOT, tfoot);
    }

    return tfoot;
  }