class_docstr: Description of a JavaScript object.
class_docstr_tok: ["Description","of","a","JavaScript","object","."]
docstr: Handle object nesting before content
  
  :py:class:`JSObject` represents JavaScript language constructs. For
  constructs that are nestable, this method will build up a stack of the
  nesting hierarchy so that it can be later de-nested correctly, in
  :py:meth:`after_content`.
  
  For constructs that aren't nestable, the stack is bypassed, and instead
  only the most recent object is tracked. This object prefix name will be
  removed with :py:meth:`after_content`.
  
  The following keys are used in ``self.env.ref_context``:
  
      js:objects
          Stores the object prefix history. With each nested element, we
          add the object prefix to this list. When we exit that object's
          nesting level, :py:meth:`after_content` is triggered and the
          prefix is removed from the end of the list.
  
      js:object
          Current object prefix. This should generally reflect the last
          element in the prefix history
docstr_tok: ["Handle","object","nesting","before","content",":","py",":","class",":","`","JSObject","`","represents","JavaScript","language","constructs",".","For","constructs","that","are","nestable",",","this","method","will","build","up","a","stack","of","the","nesting","hierarchy","so","that","it","can","be","later","de-nested","correctly",",","in",":","py",":","meth",":","`","after_content","`",".","For","constructs","that","are","n't","nestable",",","the","stack","is","bypassed",",","and","instead","only","the","most","recent","object","is","tracked",".","This","object","prefix","name","will","be","removed","with",":","py",":","meth",":","`","after_content","`",".","The","following","keys","are","used","in","``","self.env.ref_context","``",":","js",":","objects","Stores","the","object","prefix","history",".","With","each","nested","element",",","we","add","the","object","prefix","to","this","list",".","When","we","exit","that","object's","nesting","level",",",":","py",":","meth",":","`","after_content","`","is","triggered","and","the","prefix","is","removed","from","the","end","of","the","list",".","js",":","object","Current","object","prefix",".","This","should","generally","reflect","the","last","element","in","the","prefix","history"]
code: def before_content(self) -> None:
      """Handle object nesting before content
  
      :py:class:`JSObject` represents JavaScript language constructs. For
      constructs that are nestable, this method will build up a stack of the
      nesting hierarchy so that it can be later de-nested correctly, in
      :py:meth:`after_content`.
  
      For constructs that aren't nestable, the stack is bypassed, and instead
      only the most recent object is tracked. This object prefix name will be
      removed with :py:meth:`after_content`.
  
      The following keys are used in ``self.env.ref_context``:
  
          js:objects
              Stores the object prefix history. With each nested element, we
              add the object prefix to this list. When we exit that object's
              nesting level, :py:meth:`after_content` is triggered and the
              prefix is removed from the end of the list.
  
          js:object
              Current object prefix. This should generally reflect the last
              element in the prefix history
      """
      prefix = None
      if self.names:
          (obj_name, obj_name_prefix) = self.names.pop()
          prefix = (
              obj_name_prefix.strip(".") if obj_name_prefix else None
          )
          if self.allow_nesting:
              prefix = obj_name
      if prefix:
          self.env.ref_context["js:object"] = prefix
          if self.allow_nesting:
              objects = self.env.ref_context.setdefault(
                  "js:objects", []
              )
              objects.append(prefix)
  
imports: from __future__ import annotations
  import contextlib
  from typing import TYPE_CHECKING, Any, cast
  from docutils import nodes
  from docutils.parsers.rst import directives
  from sphinx import addnodes
  from sphinx.directives import ObjectDescription
  from sphinx.domains import Domain, ObjType
  from sphinx.domains.python import _pseudo_parse_arglist
  from sphinx.locale import _, __
  from sphinx.roles import XRefRole
  from sphinx.util import logging
  from sphinx.util.docfields import Field, GroupedField, TypedField
  from sphinx.util.docutils import SphinxDirective
  from sphinx.util.nodes import make_id, make_refnode, nested_parse_with_titles
label_desc: Use image node_id 6 for calling the JSObject obj's underlying member method code with example usage: obj.before_content() without return types