---
name: "HTMLDocument.InvalidNesting"
section: "3kaya"
platform: "linux"
package: "kaya"
version: "0.4.4-6.2"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/HTMLDocument.InvalidNesting"
---

# HTMLDocument.InvalidNesting(3kaya)

The specified range causes invalid nesting

## NAME

HTMLDocument::InvalidNesting - The specified range causes invalid nesting

## SYNOPSIS

**HTMLDocument::InvalidNesting(** *String* **)**

## ARGUMENTS

The String contains details of the error

## DESCRIPTION

This Exception is thrown by **HTMLDocument.addInlineElementAt (3kaya)** if the start or end positions would cause invalid nesting.

-

   p = addParagraph(parent,"This paragraph");\
    em = addInlineElementAt(p,Emphasis,3,7);\
    code = addInlineElementAt(p,ComputerCode,6,9);\
    // this attempts to make \<p\>Thi\<em\>s p\<code\>a\</em\>ra\</code\>graph\</p\>\
    // which is invalid, and so an Exception is thrown.

This Exception is also thrown by several other functions if you try to add an element inside another element which cannot contain it.

-

   p = addParagraph(parent,"");\
    list = addList(p,Unordered,0);\
    // lists cannot be contained inside paragraphs, so an exception is thrown

## AUTHORS

Kaya standard library by Edwin Brady, Chris Morris and others (kaya@kayalang.org). For further information see http://kayalang.org/

## LICENSE

The Kaya standard library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (version 2.1 or any later version) as published by the Free Software Foundation.
