Remove the complete fragment and show an empty form fragment
1545
public void reset() {
        fileLink = null;
        formFragment = new FormFragment();
        getSupportFragmentManager()
                .beginTransaction()
                .replace(R.id.root, formFragment)
                .commit();
    }
325306
function emptyEditorWhenDeleting() {
        function serializeRng(rng) {
          var body = dom.create("body");
          var contents = rng.cloneContents();
          body.appendChild(contents);
          return selection.serializer.serialize(body, { format: 'html' });
        }

        function allContentsSelected(rng) {
          if (!rng.setStart) {
            if (rng.item) {
              return false;
            }

            var bodyRng = rng.duplicate();
            bodyRng.moveToElementText(editor.getBody());
            return RangeUtils.compareRanges(rng, bodyRng);
          }

          var selection = serializeRng(rng);

          var allRng = dom.createRng();
          allRng.selectNode(editor.getBody());

          var allSelection = serializeRng(allRng);
          return selection === allSelection;
        }

        editor.on('keydown', function (e) {
          var keyCode = e.keyCode, isCollapsed, body;

          // Empty the editor if it's needed for example backspace at <p><b>|</b></p>
          if (!isDefaultPrevented(e) && (keyCode == DELETE || keyCode == BACKSPACE)) {
            isCollapsed = editor.selection.isCollapsed();
            body = editor.getBody();

            // Selection is collapsed but the editor isn't empty
            if (isCollapsed && !dom.isEmpty(body)) {
              return;
            }

            // Selection isn't collapsed but not all the contents is selected
            if (!isCollapsed && !allContentsSelected(editor.selection.getRng())) {
              return;
            }

            // Manually empty the editor
            e.preventDefault();
            editor.setContent('');

            if (body.firstChild && dom.isBlock(body.firstChild)) {
              editor.selection.setCursorLocation(body.firstChild, 0);
            } else {
              editor.selection.setCursorLocation(body, 0);
            }

            editor.nodeChanged();
          }
        });
      }
1162020
function(e) {
      if (this.onbeforeunload && this.onbeforeunload()) {
        var fragment = this.fragment;
        this.fragment = '';
        return this.navigate(fragment, {trigger: false});
      }
      var current = this.getFragment();
      if (current == this.fragment && this.iframe) current = this.getFragment(this.getHash(this.iframe));
      if (current == this.fragment) return false;
      if (this.iframe) this.navigate(current);
      this.loadUrl() || this.loadUrl(this.getHash());
    }
522081
def empty(self):
        """"""
        self._selected_item = None
        self._selected_key = None
        super(ListView, self).empty()
684214
def emptyElement(self, name, attrs):
        """"""
        attr = ' '.join('%s=%s' % (n, quoteattr(scientificformat(v)))
                        for n, v in sorted(attrs.items()))
        self._write('<%s %s/>' % (name, attr))
213858
function () {

    // if rendered, then just return the fragment
    if (this._rendered) {
      return this.section.render();
    }

    this._rendered = true;

    if (this._cleanupJanitor) {
      this._cleanupJanitor.dispose();
    }

    if (!this.section) {
      this._createSection();
    }

    this.willRender();
    this.emit("render");

    var fragment = this.section.render();

    this.didRender();
    this._updateVisibility();

    return fragment;
  }
931959
function fragment(html) {
  var args = arguments
  var i = 1
  return domify(html.replace(/%([se])/g, function(_, type){
    switch (type) {
      case 's': return String(args[i++])
      case 'e': return escape(args[i++])
    }
  }))
}
36438
def realForm(self, req, tag):
        
        self.liveForm.setFragmentParent(self)
        return self.liveForm
565891
def end_element(self, tag):
        """"""
        if tag == u'form':
            self.forms.append(self.form)
            self.form = None
934337
function() {
			if ( $.fn.resetForm ) {
				$(this.currentForm).resetForm();
			}
			this.submitted = {};
			this.lastElement = null;
			this.prepareForm();
			this.hideErrors();
			this.elements().removeClass( this.settings.errorClass ).removeData( "previousValue" );
		}
446510
public function beforeDisplay()
    {
        if ($this->_form instanceof \Gems_TabForm) {
            if ($links = $this->getMenuList()) {
                $linkContainer = \MUtil_Html::create()->div(array('class' => 'element-container-labelless'));
                $linkContainer[] = $links;

                $element = $this->_form->createElement('html', 'formLinks');
                $element->setValue($linkContainer)
                        ->setOrder(999)
                        ->removeDecorator('HtmlTag')
                        ->removeDecorator('Label')
                        ->removeDecorator('DtDdWrapper');

                $this->_form->resetContext();
                $this->_form->addElement($element);

                if (is_null($this->_form->getDisplayGroup(\Gems_TabForm::GROUP_OTHER))) {
                    $this->_form->addDisplayGroup(array($element), \Gems_TabForm::GROUP_OTHER);
                } else {
                    $this->_form->getDisplayGroup(\Gems_TabForm::GROUP_OTHER)->addElement($element);
                }
            }
        } else {
            if (\MUtil_Bootstrap::enabled() !== true) {
                $table = new \MUtil_Html_TableElement(array('class' => $this->class));
                $table->setAsFormLayout($this->_form, true, true);

                // There is only one row with formLayout, so all in output fields get class.
                $table['tbody'][0][0]->appendAttrib('class', $this->labelClass);

                if ($links = $this->getMenuList()) {
                    $table->tf(); // Add empty cell, no label
                    $table->tf($links);
                }
            } elseif($links = $this->getMenuList()) {
                $element = $this->_form->createElement('html', 'menuLinks');
                $element->setValue($links);
                $element->setOrder(999);
                $this->_form->addElement($element);
            }
        }
    }
1015264
function fragment(content) {
    var active = pagelet.active;

    if (!active) content = '';
    if (mode === 'sync') return fn.call(context, undefined, content);

    data.id = data.id || pagelet.id;                 // Pagelet id.
    data.path = data.path || pagelet.path;           // Reference to the path.
    data.mode = data.mode || pagelet.mode;           // Pagelet render mode.
    data.remove = active ? false : pagelet.remove;   // Remove from DOM.
    data.parent = pagelet._parent;                   // Send parent name along.
    data.append = pagelet._append;                   // Content should be appended.
    data.remaining = pagelet.bootstrap.length;       // Remaining pagelets number.
    data.hash = {                                    // Temper md5's for template ref
      error: temper.fetch(pagelet.error).hash.client,
      client: temper.fetch(pagelet.view).hash.client
    };

    fn.call(context, undefined, framework.get('fragment', {
      template: content.replace(/<!--(.|\s)*?-->/, ''),
      name: pagelet.name,
      id: pagelet.id,
      state: state,
      data: data
    }));

    return pagelet;
  }
509475
def process_form(self, instance, field, form, empty_marker=None,
                     emptyReturnsMarker=False):
        

        # a poor workaround for Plone repeating itself.
        # XXX this is important XXX
        key = field.getName() + '_value'
        if key in instance.REQUEST:
            return instance.REQUEST[key], {}
        value = form.get(field.getName(), empty_marker)
        # When a recordswidget's visibility is defined as hidden
        # '...visible={'view': 'hidden', 'edit': 'hidden'},...' the template
        # displays it as an input field with the attribute 'value' as a string
        # 'value="[{:},{:}]"'. This makes the system save the content of the
        # widget as the string instead of a dictionary inside a list, so we
        # need to check if the variable contains a python object as a string.
        if value and value is not empty_marker and isinstance(value, str):
            import ast
            try:
                value = ast.literal_eval(form.get(field.getName()))
            except:
                # cannot resolve string as a list!
                return empty_marker

        if not value:
            return value, {}
        if value is empty_marker:
            return empty_marker
        if emptyReturnsMarker and value == '':
            return empty_marker

        # we make sure that empty "value" inputs are saved as "" empty string.
        for i in range(len(value)):
            value[i] = dict(value[i])
            if 'value' not in value[i]:
                value[i]['value'] = ''

        instance.REQUEST[key] = value
        return value, {}
1357381
def _finish_fragment(self):
        

        if self.fragment:
            self.fragment.finish()
            if self.fragment.headers:
                # Regardless of what's been seen to this point, if we encounter a headers fragment,
                # all the previous fragments should be marked hidden and found_visible set to False.
                self.found_visible = False
                for f in self.fragments:
                    f.hidden = True
            if not self.found_visible:
                if self.fragment.quoted \
                        or self.fragment.headers \
                        or self.fragment.signature \
                        or (len(self.fragment.content.strip()) == 0):

                    self.fragment.hidden = True
                else:
                    self.found_visible = True
            self.fragments.append(self.fragment)
        self.fragment = None
916929
@Nullable
    private static View getEmptyView(@Nullable View rootView) {
        if (rootView == null) {
            throw new RuntimeException("A null rootView was passed to getEmptyView, but Hits/RefinementList require one.");
        }
        return rootView.findViewById(android.R.id.empty);
    }
444318
function getItemsFragment() {
  var fragment = document.createDocumentFragment();
  for ( var i = 0; i < 7; i++ ) {
    var item = getImageItem();
    fragment.appendChild( item );
  }
  return fragment;
}
6982
function onPaste(
    // The plugin options
    opts?: Options,
    event: *,
    change: Change,
    editor: Editor
): Object {
    // Outside of tables, do not alter paste behavior
    if (!isSelectionInTable(opts, change.value)) {
        return undefined;
    }

    const transfer = getEventTransfer(event);
    const { type, fragment } = transfer;

    if (type != 'fragment' || fragment.nodes.isEmpty()) {
        return null;
    }

    if (
        !isRangeInTable(
            opts,
            fragment,
            Range.create({
                anchorKey: fragment.getFirstText().key,
                focusKey: fragment.getLastText().key
            })
        )
    ) {
        return null;
    }

    return insertTableFragmentAtRange(
        opts,
        change,
        change.value.selection,
        fragment
    );
}