Skip to content

.addClass section shows unexpected error message #1184

Closed
jquery/grunt-jquery-content
#80
@anderlaw

Description

@anderlaw

When checking out the jQuery's API document, I found a very confusing message, which is marked in the image below:

Snipaste_2021-05-01_14-44-03

I try to figure out why based on the Error Message:ERROR: A single return element is expected, then I found there are two return types String or Array:

 <signature>
    <added>3.3</added>
    <argument name="function" type="Function">
      <desc>A function returning one or more space-separated class names or an array of class names to be added to the existing class name(s). Receives the index position of the element in the set and the existing class name(s) as arguments. Within the function, <code>this</code> refers to the current element in the set.</desc>
      <argument name="index" type="Integer" />
      <argument name="currentClassName" type="String" />
      <return type="String"/>
      <return type="Array"/>
    </argument>
  </signature>

then I try to find out why it didn't support two return types, because it should be, finally located to an npm package named grunt-jquery-content 's entries2html-base.xsl file:
and when I modified the code from

	<!-- a return element -->
	<xsl:if test="return">
		<xsl:for-each select="return">
			<xsl:if test="position() &gt; 1">
				<strong>ERROR: A single return element is expected</strong>
			</xsl:if>
			<xsl:call-template name="render-types"/>
		</xsl:for-each>
	</xsl:if>

to

	<!-- a return element -->
	<xsl:if test="return">
		<xsl:for-each select="return">
			<xsl:if test="position() &gt; 1">
				<span> | </span>
			</xsl:if>
			<xsl:call-template name="render-types"/>
		</xsl:for-each>
	</xsl:if>

the error message missed, and everything includes links works fine:
fine

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions